Opened 17 years ago

Closed 17 years ago

#5188 closed (duplicate)

archive_index shouldn't do explicit ordering

Reported by: James Bennett Owned by: nobody
Component: Generic views Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, the date-based archive_index and archive_year (when make_object_list is True) generic views use explicit calls to order_by to re-order the QuerySet they receive. There are two problems with this:

  1. They do it inconsistently: archive_index sorts by date_field descending, while archive_year sorts by date_field ascending.
  2. In doing so, they override any ordering specified by the model or already applied to the QuerySet, reducing their flexibility.

For sake of consistency with each other and with the other date-based generic views, and to restore the flexibility of allowing the user to choose how the QuerySet will be ordered, both views should stop trying to do an explicit order_by.

Attachments (1)

generic_views_no_explicit_ordering.diff (790 bytes ) - added by James Bennett 17 years ago.
Patch which removes the order_by calls

Download all attachments as: .zip

Change History (5)

by James Bennett, 17 years ago

Patch which removes the order_by calls

comment:1 by Simon G. <dev@…>, 17 years ago

Has patch: set
Triage Stage: UnreviewedReady for checkin

Sounds fairly sensible. Do we need to add info about the ordering to the generic views docs?

comment:2 by Malcolm Tredinnick, 17 years ago

Triage Stage: Ready for checkinDesign decision needed

This isn't ready to commit yet. There's a genuine issue that's been raised by Gary Wilson in the related django-dev thread (the third post).

comment:3 by Gary Wilson, 17 years ago

Summary: archive_year and archive_index shouldn't do explicit orderingarchive_index shouldn't do explicit ordering

Renaming ticket to just deal with archive_index, as there is already a ticket open (#3134) for archive_year (and it doesn't have the issue mentioned in the django-dev thread posted above).

comment:4 by James Bennett, 17 years ago

Resolution: duplicate
Status: newclosed

I'm closing this because Gary fixed archive_year in [6057] and he's right that archive_index shouldn't be changed.

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