counter in django template

{{ forloop.counter }}   ->  The current iteration of the loop (1-indexed)
{{ forloop.counter0 }}  ->  The current iteration of the loop (0-indexed)

Here is what the above code is Doing:
1. We’re iterating over the list of dictionaries in the context variable.
2. We’re creating a new dictionary with the key ‘name’ and the value of the ‘name’ key in the dictionary we’re iterating over.
3. We’re creating a new dictionary with the key ‘age’ and the value of the ‘age’ key in the dictionary we’re iterating over.
4. We’re creating a new dictionary with the key ‘occupation’ and the value of the ‘occupation’ key in the dictionary we’re iterating over.
5. We’re creating a new dictionary with the key ‘is_cool’ and the value of the ‘is_cool’ key in the dictionary we’re iterating over.
6. We’re creating a new dictionary with the key ‘forloop’ and the value of the ‘forloop’ key in the dictionary we’re iterating over.
7. We’re creating a new dictionary with the key ‘counter’ and the value of the ‘counter’ key in the dictionary we’re iterating over.
8. We’re creating a new dictionary with the key ‘counter0’ and the value of the ‘counter0’ key in the dictionary we’re iterating over.
9. We’re creating a new dictionary with the key ‘first’ and the value of the ‘first’ key in the dictionary we’re iterating over.
10. We’re creating a new dictionary with the key ‘last’ and the value of the ‘last’ key in the dictionary we’re iterating over.
11. We’re creating a new dictionary with the key ‘parent’ and the value of the ‘parent’ key in the dictionary we’re iterating over.