Opened 6 years ago

Closed 6 years ago

#12110 closed (duplicate)

dictsort is not stable sort

Reported by: eronen Owned by: nobody
Component: Template system Version: 1.1
Severity: Keywords: dictsort
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I'm trying to sort a list first by owner, then by date, like this:

{% for item in items|dictsort:"date"|dictsort:"owner" %}

Python's sort method is stable (preserves the order if the sort key is the same), so I assumed dictsort would be, too.
But it's not!

Ticket #11008 has a patch which fixes this problem, too (although #11008 is not
about sort stability as such).

Change History (1)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #11008 (if you interpret that ticket as "dictsort is broken")

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