I have a basic question, in the Django template language how can you tell if you are at the last loop iteration for a "for loop"?
+11
A:
You would use forloop.last
. For example:
<ul>
{% for item in menu_items %}
<li{% if forloop.last %} class='last'{% endif %}>{{ item }}</li>
{% endfor %}
</ul>
Paolo Bergantino
2009-05-07 21:59:12
That was what I needed!
Daniel
2009-05-07 22:02:47