Auto Increment Value In Django
i have an table in django and try to auto increment it's serial no. in custom template for loop is used for the variables. custom template {% for i in getodeskview %}
Solution 1:
Use {{ forloop.counter }}
inside loop to get the index.
https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#for
Solution 2:
Use forloop_counter. This keeps track of the number of times the loop has run so far.
Solution 3:
Use {{ forloop.counter }}
.
Source: Built-in template tags and filters #for
I hope it will solve you problem
Post a Comment for "Auto Increment Value In Django"