I would like to know how to replicate this in django:
for photo in gallery
if counter is 1
then use this photo
endif
endfor
how do I check the forloop counter if it is "1"?
{% for photo in gallery %}
{% if forloop.counter == 1 %}
Do something with {{ photo }}.
{% endif %}
{% endfor %}
this is equivalent to:
{% for photo in gallery %}
{% if forloop.first %}
Do something with {{ photo }}.
{% endif %}
{% endfor %}
Reference: Django docs