django addition -
how increment value of variable in template..??
{% s in list%} {% subject in s%} {% sub in subject %} <div id="{{ sub| getid:i }}"></div> # here want increment value of {% endfor %} {% endfor %} {% endfor %}
if want increase i
on nested loops, can pass stateful context variable, such i=itertools.count()
, , in template, use
<div id="{{ sub| getid:i.next }}"></div>
the django documentation on template language design states philosophy of template language that
the template system meant express presentation, not program logic.
and means cannot manipulate state directly filters. achieve state changes, have create own stateful variables state can altered via function call.
Comments
Post a Comment