from django.template import Library
register = Library()
@register.filter
def get_range( value ):
"""
Filter - returns a list containing range made from given value
Usage (in template):
{% for i in 3|get_range %}
- {{ i }}. Do something
{% endfor %}
Results with the HTML:
- 0. Do something
- 1. Do something
- 2. Do something
Instead of 3 one may use the variable set in the views
"""
return range( value )