this is my code :
{% for i,j in enumerate(a) %} {{i}} ,{{j}} {% endfor%}
but , it show a error , i think it cant run the enumerate method ,
enumerate
so how to run the enumerate in django template ,
thanks
you can use {{ forloop.counter }} or {{ forloop.counter0 }} for the same effect, the latter is 0-indexed, thus more like enumerate.
{{ forloop.counter }}
{{ forloop.counter0 }}