Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#539 closed defect (fixed)

Support for strides in the slice filter.

Reported by: Esaj Owned by: adrian
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: UI/UX:

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 10 years ago.
efficient_slice.patch (877 bytes) - added by Esaj 10 years ago.
A more efficient implementation of slice supporting strides.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Esaj

comment:1 Changed 10 years ago by adrian

  • Status changed from new to assigned

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

Changed 10 years ago by Esaj

A more efficient implementation of slice supporting strides.

comment:2 Changed 10 years ago by Esaj

Practically did it in one line :)

comment:3 Changed 10 years ago by adrian

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in [666].

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