django template for range

41

{% with ''|center:n as range %}
{% for _ in range %}
    {{ forloop.counter }}
{% endfor %}
{% endwith %}
{% for item in "x"|ljust:"100" %}
    {{item}} {# or do anything 100 times #}
{% endfor %}
{% load my_filters %}
{% for i in 15|times %}
    <li>Item</li>
{% endfor %}
@register.filter(name='times') 
def times(number):
    return range(number)

Comments

Submit
0 Comments