How do I write a numeric for loop in a Django template? I mean something like
for
for i = 1 to n
I tried very hard on this question, and I find the best answer here: (from how to loop 7 times in the django templates)
You can even access the idx!
views.py:
context['loop_times'] = range(1, 8)
html:
{% for i in loop_times %} {{ i }} {% endfor %}