#13088: Template range filter
---------------------------------+--------------------------------------
Reporter: makoste | Owner: nobody
Type: New feature | Status: closed
Component: Template system | Version: 1.2-beta
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by timgraham):
* ui_ux: => 0
* type: => New feature
* easy: => 0
* severity: => Normal
Old description:
> def range( value ):
> """
> Filter - returns a list containing range made from given value
> Usage (in template):
>
> <ul>{% for i in 3|range %}
> <li>{{ i }}. Do something</li>
> {% endfor %}</ul>
>
> Results with the HTML:
> <ul>
> <li>0. Do something</li>
> <li>1. Do something</li>
> <li>2. Do something</li>
> </ul>
>
> Instead of 3 one may use the variable set in the views
> """
> return range( value )
New description:
{{{
def range( value ):
"""
Filter - returns a list containing range made from given value
Usage (in template):
<ul>{% for i in 3|range %}
<li>{{ i }}. Do something</li>
{% endfor %}</ul>
Results with the HTML:
<ul>
<li>0. Do something</li>
<li>1. Do something</li>
<li>2. Do something</li>
</ul>
Instead of 3 one may use the variable set in the views
"""
return range( value )
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/13088#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.67ebe5dbccb8414080120f0c26ac12d1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.