Opened 18 years ago
Closed 17 years ago
#2450 closed enhancement (wontfix)
Add ascending sort option to date_based generic views
Reported by: | noods | Owned by: | Jacob |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | minor | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It would be nice to have the ability to change the sort order of objects in date_based generic views. With the new addition of the allow_future option it makes sense to be able to sort by ascending date order instead of the default descending order.
For example in an event calendar you want to show upcoming events first.
Attachments (2)
Change History (9)
by , 18 years ago
Attachment: | sort.patch added |
---|
comment:1 by , 18 years ago
Summary: | add ascending sort option to date_based generic views → [patch] add ascending sort option to date_based generic views |
---|
comment:2 by , 18 years ago
After some thought I'm not sure this is necessary. I can just as easily just use an object_list generic view to get whichever objects I want in whatever order - the only thing I lose is the date_list context var, which would be easy to add if I want it.
Feel free to resolve.
comment:3 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Closing for the reason you pointed out in the previous comment.
comment:4 by , 17 years ago
Ignore my patch, intended to be an alternative - it doesn't work well with the other views.
by , 17 years ago
Attachment: | allow_ascending.diff added |
---|
comment:5 by , 17 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Resolution: | wontfix |
Status: | closed → reopened |
My patch is fixed, so I'll describe it:
I have a site with many date-based views which share templates, and it just turned out that some needed to be ascending and some descending. The Django way would be to let me reverse the sort order, rather than make me rewrite some of them using generic list views.
My patch allows "-" in front of the date_field parameter to reverse the order. It also works with the other date_based views (not just archive), and sorts all the views by the date field as well.
comment:6 by , 17 years ago
Summary: | [patch] add ascending sort option to date_based generic views → Add ascending sort option to date_based generic views |
---|
comment:7 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Wontfixing again - see Adrian's comment.
I should clarify slightly, I'm talking about the archive_index view and changing the sort order of the "latest" objects.