rendered paste body
# the function
def divisibleby(value, arg):
"Returns true if the value is devisible by the argument"
return int(value) % int(arg) == 0
# template
{% for athlete in athletes_team.list %}
{% if forloop.counter|divisibleby:"3" %}<tr>{% endif %}
<td{% if athlete.chosen %}class="selected"{% endif %}>
<input type="checkbox" name="id" id="athlete{{ athlete.id_ }}" value="{{ athlete.id_ }}" {% if athlete.chosen %}checked{% endif %}>
<label for="athlete{{ athlete.id_ }}">{{ athlete }}</label>
</td>
{% if footloop.counter|add:"2"|divisibleby:"3" %}</tr>{% endif %}
{% endfor %}