Essentially the logic here is to create 3 columns where
there are n rows in each.
The first conditional will add an initial column tag if the loop is
beginning a new column. The second conditional adds a closing column
tag when the loop ends a column.
{% endcomment %}
{% for listing in my_lookouts %}
{% if forloop.counter|add:-1|divisibleby:rows %}
<divclass="col-md-4">
{% endif %}
{% include 'listing_preview_panel.html' %}
{% if forloop.counter|add:rows|divisibleby:rows %}
</div>
{% endif %}
{% endfor %}
</div>
{% else %}
<divclass="row">
<divclass="col-md-10 col-md-offset-1">
<divclass="panel panel-warning">
<divclass="panel-body text-center">
<h3>No lookout results found.</h3>
<p>
Lookouts are automatic searches for books you have an eye out for. You can create some <ahref="#">here</a>, and we'll automatically show you when a listing you want goes up.