Reputation: 1650
How to keep count of for loop in google app engine. Like in Django {forloop.counter}, I have used this
{% for user in users %}
{{forloop.counter}}
{%endfor%}
but this giver error as :
UndefinedError: 'forloop' is undefined
Need help with Syntax/App Engine
Library:
libraries:
- name: jinja2
version: latest
Upvotes: 1
Views: 444
Reputation: 89897
In Jinja2 templates, you can access a loop counter with:
{{loop.index}}
(which is 1-indexed like Django's forloop.counter
; for 0-indexed use loop.index0
)
Upvotes: 4