[Answer]-Every 2nd and 3rd and 4th and 5th and so on

1👍

You can use a mixture of conditions to accomplish this:

<div class=container>
    {% for news in news_list %}
    {% if forloop.counter > 1 %}
        {% if forloop.counter|divisibleby:"2" %}
            {% if forloop.counter > 2 %}
            </div>
            {% endif %}
            <div class="row">
        {% endif %}
    <div class=col-md-6>{{ news }}</div>
    {% endif %}
    {% endfor %}
    </div>
</div>
👤Selcuk

Leave a comment