Question : adding bootstrap grid dynamically django
Answered by : odd-ocelot-y3hdzhkw3tq8
{% for sub_article in articles %} {% if forloop.first %}<div class="row">{% endif %} <div class="col-xs-4"> <a href="#"> {{ sub_article.name }} </a> </div> {% if forloop.counter|divisibleby:3 %}</div><div class="row">{% endif %} {% if forloop.last %}</div>{% endif %}
{% endfor %}
Source : https://stackoverflow.com/questions/20309593/django-template-to-populate-bootstrap-rows-and-columns | Last Update : Wed, 21 Apr 21