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...
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...
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...
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...
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...
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...
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...
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...
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:...
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...