[Fixed]-Django template forloop

1👍

Here’s something you can do

In the views

import itertools
counter = itertools.count()
# pass `counter` to the template

In the template

{{counter.next}} 

to display and increment the counter regardless of the loop you’re in.

👤NS0

Leave a comment