I\'m creating a catalogue, where there is a list of items of undefined length. I want to spit it out in rows with three columns each. So I have the following html:
You can use forloop.counter variable and divisibleby filter. The code will be close to this:
{% for item in items %}
{% if forloop.first %}
{% endif %}
{{ item }}
{% if forloop.counter|divisibleby:"3" %}
{% if not forloop.last %}
{% endif %}
{% endif %}
{% if forloop.last %}
{% endif %}
{% endfor %}