Opened 17 years ago

Last modified 13 years ago

#5567 closed

Last and nth template filters — at Initial Version

Reported by: Chris H. Owned by: nobody
Component: Template system Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

It seemed like an oversight that there wasn't a "last" template filter similar to the "first" filter. I wrote it up, along with tests, and added in an nth filter that takes an arg and accessing that index of the value.

last([0, 1, 2, 3, 4])

4

last(u'Hello')

u'o'

nth(['a', 'b', 'c', 'd'], 1)

'b'

nth(u'abcd', 1)

u'b'

Change History (1)

by Chris H., 17 years ago

Attachment: last_and_nth_filters.diff added
Note: See TracTickets for help on using tickets.
Back to Top