python - Django template forloopcounter value is not working -


the list follows. here forloopcounter value not working. how fix? please let me know views. please note: static index value working, dynamic index value not working (forloopcounter)

value = [     {         "pk": 1,         "rate": [             {                 "one": "one1"             },             {                 "two": "two1"             }         ]     },     {         "pk": 2,         "rate": [             {                 "one": "one2"             },             {                 "two": "two2"             }         ]     } ]   {% in value %}  {{i.rate.forloopcounter.one}} # here forloopcounter value not working {{i.rate.0.one}} # working properly. need dynamic index  {% endfor %} 

i don't think you're using think you're using.

{% in dict %}     {{forloop.counter}} 

forloop.counter increments on each iteration through dictionary. forloopcounter not key in dictionary, why code doesn't work.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -