I'm having a difficult time understanding what Django's forloop.counter is. My intention is to wrap each three iterations of a for loop in a <div>. How I would expect it to work is something like:
{% for staff in staff_members %}
{% if (forloop.counter + 2 % 3) == 0 %} // if loop is the first of three
<div class="row">
{% endif %}
{{ staff }}
// close <div class="row"> if loop is last of three
{% endfor %}
This doesn't work because it seems Django doesn't like to operate on the forloop.counter. It seems overly complicated to do this operation in the view, I'd much rather do it in the template as it's purely a presentational / style issue.