# add following to mysite/myapp/templatetags/myapp_tags.py from django import template register = template.Library() @register.filter def mod(value, arg): return value % arg #put following in your template and change mod:5 #according to the number of cells per table row desired {% load pictures_tags %}
{% if not forloop.counter|mod:5 %} |