Opened 11 years ago
Closed 10 years ago
#21450 closed Cleanup/optimization (fixed)
BaseYearArchiveView prevent ordering of queryset
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | 1.5 |
Severity: | Normal | Keywords: | BaseYearArchiveView filtering |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In BaseYearArchiveView, the get_dated_items calls the get_dated_queryset with an extra parameter ordering="-%s" : qs = self.get_dated_queryset(ordering='-%s' % date_field, * * lookup_kwargs)
This behavior is not the same as in BaseMonthArchiveView (which do qs = self.get_dated_queryset(* * lookup_kwargs))
and prevents from using custom filtering in get_queryset.
Could you please remove the extra ordering="-%s" in the BaseYearArchiveView and let the user handle the filtering?
Thanks a lot
Change History (8)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
comment:3 by , 11 years ago
Is the current behavior documented? I see some references to ordering in the docs. Would this be a backwards incompatible change for people relying on the current behavior? If we can call it a bug, we may be able to change it (and sooner rather than later would be best). Can you submit a patch with a test that demonstrates the new functionality that we'd be adding?
comment:5 by , 11 years ago
Has patch: | unset |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
Accepting on the basis of the problem, not sure about the proposed solution at this point.
comment:6 by , 11 years ago
comment:8 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closing per above commit as I believe it solves it, but please reopen if not.
Hello,
I actually see that there is also a default filtering + ordering in BaseArchiveIndexView:
Should be replaced by: