Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assuming you have a list of items you want to display in three columns, you can achieve this by looping through the list with a for loop and using the slice filter to split the list into groups of three. Here's an example:

{% for group in items|slice:"3" %}
  <div class="row">
    {% for item in group %}
      <div class="col-md-4">
        {{ item }}
      </div>
    {% endfor %}
  </div>
{% endfor %}

In this example, items is the list of items you want to display, and we use the slice filter to split it into groups of three. Then we loop through each group and create a new row for each one, with three columns inside for each item. The col-md-4 class ensures that each column takes up 1/3 of the available width.