How to increment a variable in a template Django

Published: 14/01/2019
How to increment a variable in a template Django
Source: STACKOVERFLOW.COM

here is my views.py file in which i have delcared function subhead that load account objects to view def subhead(request): subheads=Account.objects.all() return render(request,'my/test.html',{'accounts':subheads}) here is my template {% for subhead in subheads %} {% with i=0 %} {% if subhead.parent == None and subhead.type == 'As' %} {% if i == 0 %} <tr> <td>Assets</td> <

Read more
Related news
Comment
FACEBOOK