1👍
{% for photo in album.images.all %}
{{ photo }}
{% if forloop.counter|divisibleby:4 %}
<hr> {# or some other markup #}
{% endif
{% endfor %}
You might also do the grouping in your view. This might result in cleaner markup. See: Django template {%for%} tag add li every 4th element
Source:stackexchange.com