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
Post a Comment