Opened 20 years ago

Closed 20 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
Pull Requests:How to create a pull request

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.

Change History (5)

by Esaj, 20 years ago

Attachment: defaultfilters.py.diff added

comment:1 by Adrian Holovaty, 20 years ago

Status: newassigned

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

by Esaj, 20 years ago

Attachment: efficient_slice.patch added

A more efficient implementation of slice supporting strides.

comment:2 by Esaj, 20 years ago

Practically did it in one line :)

comment:3 by Adrian Holovaty, 20 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [666].

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