Jinja2 - Render list items in groups of x
<p>I am looking to output a list of items in a table in a jinja2 template. </p>

<p>current code:</p>

<pre><code>&lt;table style="width:100%"&gt;
{% for i in sales %}
  &lt;tr&gt;
     &lt;td&gt;{{i}}&lt;/td&gt;
  &lt;/tr&gt;
{% endfor %}
&lt;/table&gt;
</code></pre>

<p>Which results in:</p>

<pre><code>item
item
item
item
...
</code></pre>

<p>Expected output:</p>

<pre><code>item    item    item        
item    item    item    
item    item    item    
item    item    item    
...
</code></pre>

<p>I would like the output to be spread over three columns, ie. loop from left to right in the table and then start a new row after 3 items. </p>