3

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>&nbsp;&nbsp;
 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!

1 Answer 1

5

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.