Django

Code

Ticket #1162 (closed: wontfix)

Opened 5 years ago

Last modified 4 years ago

[patch] added range0, range1 filter

Reported by: nkeric@gmail.com Assigned to: adrian
Milestone: Component: Template system
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

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

defaultfilters.diff (0.7 kB) - added by nkeric@gmail.com on 01/04/06 02:47:44.
added range0 and range1 filter

Change History

01/04/06 02:47:44 changed by nkeric@gmail.com

  • attachment defaultfilters.diff added.

added range0 and range1 filter

02/27/06 17:47:45 changed by jacob

  • status changed from new to closed.
  • resolution set to wontfix.

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


Add/Change #1162 ([patch] added range0, range1 filter)




Change Properties
Action