[Solved]-Django – skip first row of array

30πŸ‘

βœ…

{% for a in array|slice:"1:" %}{{ a }}{% endfor %}

See https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#slice for more information.

πŸ‘€Jeremy Lewis

9πŸ‘

{% for a in array %}
  {% if not forloop.first %}
    {{ a }}
  {% endif %}
{% endfor %}

There is of course forloop.last for the last iteration as well.

They are all listed in the Django reference.

2πŸ‘

{% for a in array %}
{% if forloop.counter != 1 %}
    {{ a }}
{% endif %}
{% endfor %}

Leave a comment