Reputation: 1937
hello i have the code below on my template but can't get the loop.counter property is there anything wrong on the code?
{% for res in res_list %}
79 <div id="tr_{{ res.id }}">
80 <li><span data-acttion='rename' class="resname edit" id="zaab{{ loop.counter }}">{{ res.id }}</span>
81
82 <span class="edit resexpr" data-id="{{ res.id }}">{{ res.expr_highlight|safe }}</span></dd>
83 <input type="button" id="pickMeUp" value="pickMeUp">
84 </div>
85 </li>
86 {% endfor %}
and the problem i have is on line 80 where i have that:
id="zaab{{ loop.counter }}"
the output on the browser is just zaab
if i change it to loop.first
the output is zaabTrue on first look so there is something with count i think!
Upvotes: 3
Views: 2150
Reputation: 1937
Ok solved i was looking jinja 1 commands in jinja 2.0 that command doesn't even exist so you can use loop.index instead!
Upvotes: 5