django: mkrange - create a range() inside a template 
I've found a nice snippet of code which adds a range capability for Django templating engine. Link in related links below.


Accepts the same arguments as the 'range' builtin and creates
a list containing the result of 'range'.

Syntax:
{% mkrange [start,] stop[, step] as context_name %}

For example:
{% mkrange 5 10 2 as some_range %}
{% for i in some_range %}
{{ i }}: Something I want to repeat\n
{% endfor %}

Produces:
5: Something I want to repeat
7: Something I want to repeat
9: Something I want to repeat


[ add comment ] ( 10 views )   |  [ 0 trackbacks ]   |  permalink  |  related link

<<First <Back | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Next> Last>>