user2106353
user2106353

Reputation: 1249

Skip particular step in forloop Django

HI i am using a forloop in django template

{% for image in images %}
{% endfor %}

which executes for 10 steps

but i want to skip the 5th step and execute for remaining how can i do this please suggest ...

Upvotes: 0

Views: 1040

Answers (2)

user2106353
user2106353

Reputation: 1249

{% for image in images %}
   {% if forloop.counter0 != 5 %}
    ...
   {% endif %}
{% endfor %}

this works for me

Upvotes: 0

Pavel Anossov
Pavel Anossov

Reputation: 62948

{% for image in images %}
   {% if forloop.counter != 5 %}
    ...
   {% endif %}
{% endfor %}

https://docs.djangoproject.com/en/dev/ref/templates/builtins/#for

Upvotes: 5

Related Questions