Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#539 closed defect (fixed)

Support for strides in the slice filter.

Reported by: Esaj Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords: slice strides
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This patch adds support for strides in the slice filter.

For example:

{% my_list|slice:"::2" %}

should include every other element of my_list.

Attachments (2)

defaultfilters.py.diff (1.3 KB ) - added by Esaj 19 years ago.
efficient_slice.patch (877 bytes ) - added by Esaj 19 years ago.
A more efficient implementation of slice supporting strides.

Download all attachments as: .zip

Change History (5)

by Esaj, 19 years ago

Attachment: defaultfilters.py.diff added

comment:1 by Adrian Holovaty, 19 years ago

Status: newassigned

We might be able to solve this more efficiently using the slice() built-in function.

by Esaj, 19 years ago

Attachment: efficient_slice.patch added

A more efficient implementation of slice supporting strides.

comment:2 by Esaj, 19 years ago

Practically did it in one line :)

comment:3 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [666].

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