Questions tagged as 'django-templates'

2
answers

How to call a method of views in html?

I created the following method in the views.py file: def home(request): name = 'Jacinto' args = {'myName' : name} return render(request, 'accounts/home.html', args) I want to now call this function that redirects me to the home.htm...
asked by 11.01.2018 / 16:29
1
answer

Total values in django template

I'm developing a forum that in the index page I need to show the subject, how many topics have this subject and how many posts, I even get back number of topics, but only shows the topic with the subject id 1, for example if you have subject 2 w...
asked by 26.11.2017 / 03:26
1
answer

NoReverseMatch Error in Django

Hello! Studying Django and developing in this Framework, I came across the following error:    NoReverseMatch at / Reverse for 'displayURL' with arguments '(' ',)' not   found . 1 pattern (s) tried: ['profiles / (? P \ d +) $'] For a...
asked by 27.01.2018 / 00:45
1
answer

JQuery, total table

I am not able to generate an overall total of my table, in each row I have the quantity and price. I need to generate the total value. The current logic is reading all the rows of the table and accumulating the total of the rows. The problem...
asked by 15.04.2017 / 06:17
2
answers

ELIF using not in, within a FOR

I would like to know if there is any way to refine the ELIF within a FOR, so that it does not enter in the FOR whenever the date does not exist, but rather if that date does not exist. Here's the problem: For each meeting date {%for u in...
asked by 08.11.2018 / 00:37
2
answers

Returning manager in template (Django)

How do I return the number of books published in the template? I have this # models.py class PublishedManager(models.Manager): def published(self): return self.filter(published=True) class Book(models.Model): name = model...
asked by 08.06.2016 / 09:48
2
answers

How to go to a url in django regardless of the way we are?

I created a menu in a base file that is visible regardless of the page we are on, <p> Tela de perfil <a href="perfil/">Perfil</a></p> The problem is that when we are on the same page and click on the same lin...
asked by 17.08.2016 / 01:28
2
answers

How to display Radio Button type fields in form using Django?

I created a file called const.py (where I have the choices I'll call in models) as follows: const.py FORENSIC_TRAFFIC_LIGHTING = ( (u'1', u'Boa'), (u'2', u'Ruim'), (u'3', u'Ausente'), ) models.py class ForensicTraffic(m...
asked by 18.10.2015 / 20:23
1
answer

Returning get_FIELD_display from a list transformed into a dictionary (Django)

I wanted to make the following list into a dictionary: lists.py status_list = ( ('c', 'cancelado'), ('elab', 'em elaboração'), ('p', 'pendente'), ('co', 'concluido'), ('a', 'aprovado') ) So I did the following:...
asked by 27.07.2015 / 06:50
1
answer

How to put value in Django field goes HTML?

Hello, I'm starting with Django now and wanted to know how to pass the value of the database to a Djan field using HTML to save the edit. Na minha View: @login_required def editar_aluno(request, id): aluno = Aluno.objects.get(id=id) if...
asked by 21.11.2018 / 08:09