To add a numeric for loop in python Django templates, we can add it straight into the template.
For instance, we write
{% for i in '0123456789'|make_list %}
{{ forloop.counter }}
{% endfor %}
to add a for loop in our template that loops from 0 to 9 since we have in '0123456789' as the loop expression.
We use the make_list filter to convert '0123456789' into a list.
Then we use forloop.counter to get the index.