Answer the question
In order to leave comments, you need to log in
How do I get the number 1554 instead of {'age__sum': 1554} when creating my own template tag?
Has own tag
@register.simple_tag
def total_age():
people = Person.objects.all()
age = people.aggregate(Sum("age"))
return age
Всего = {% total_age %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question