0

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 ...

user2106353
  • 1,191
  • 3
  • 10
  • 18

2 Answers2

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

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

Pavel Anossov
  • 60,842
  • 14
  • 151
  • 124
0
{% for image in images %}
   {% if forloop.counter0 != 5 %}
    ...
   {% endif %}
{% endfor %}

this works for me

user2106353
  • 1,191
  • 3
  • 10
  • 18