I want to be able to output the current loop iteration to my template.

According to the docs, there is a loop.counter variable that I am trying to use:

<ul>
{% for user in userlist %}
  <li>
      {{ user }} {{loop.counter}}
  </li>
      {% if loop.counter == 1 %}
          This is the First user
      {% endif %}
{% endfor %}
</ul>

But is being outputed to my template. What is the correct syntax?

5 Answers
5

Leave a Reply

Your email address will not be published. Required fields are marked *