How do I write a numeric for loop in a Django template? I mean something like
for
for i = 1 to n
You can pass a binding of
{'n' : range(n) }
to the template, then do
{% for i in n %} ... {% endfor %}
Note that you'll get 0-based behavior (0, 1, ... n-1).
(Updated for Python3 compatibility)