Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#1162 closed enhancement (wontfix)

[patch] added range0, range1 filter

Reported by: nkeric@… Owned by: Adrian Holovaty
Component: Template system Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Hey guys,

I found it useful to have a range filter which acts (partly) like the python's range(), so I added this two filters: range0 - 0-index; range1 - 1-index.

It can be used like this (in a paginated page):

{% for page_number in pages|range1 %}

<a href="./?page={ forloop.counter0 }}">{{ page_number }}</a>

{% endfor %}

Hope this patch is useful for other people too :)

Attachments (1)

defaultfilters.diff (700 bytes) - added by nkeric@… 12 years ago.
added range0 and range1 filter

Download all attachments as: .zip

Change History (2)

Changed 12 years ago by nkeric@…

Attachment: defaultfilters.diff added

added range0 and range1 filter

comment:1 Changed 12 years ago by Jacob

Resolution: wontfix
Status: newclosed

This is out of the scope of the built-in templates.

Note: See TracTickets for help on using tickets.
Back to Top