Opened 18 years ago
Closed 18 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:
- They do it inconsistently:
archive_indexsorts bydate_fielddescending, whilearchive_yearsorts bydate_fieldascending. - 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)
Change History (5)
by , 18 years ago
| Attachment: | generic_views_no_explicit_ordering.diff added |
|---|
comment:1 by , 18 years ago
| Has patch: | set |
|---|---|
| Triage Stage: | Unreviewed → Ready for checkin |
Sounds fairly sensible. Do we need to add info about the ordering to the generic views docs?
comment:2 by , 18 years ago
| Triage Stage: | Ready for checkin → Design 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 , 18 years ago
| Summary: | archive_year and archive_index shouldn't do explicit ordering → archive_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 , 18 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
I'm closing this because Gary fixed archive_year in [6057] and he's right that archive_index shouldn't be changed.
Patch which removes the order_by calls