Opened 11 years ago
Closed 11 years ago
#21924 closed New feature (fixed)
added reverse order for admin_order_field
Reported by: | fetzig | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description
after adding this you can setup something like this:
def age_in_years(self): return # age calculated via DateField self.date_of_birth age_in_years.admin_order_field = '-date_of_birth'
the '-' at the beginning of '-date_of_birth' indicates the reverse order in the changelist.
already made a pull request here:
https://github.com/django/django/pull/2201
and patch is here:
https://github.com/fetzig/django/commit/2924431df1060d5ec1e0d2e6778b3c58cb85de05.patch
missing:
- patch for docs
- test(s)
won't be able to make the docs update and tests within the next week. so everybody is very welcome if you like to do that :)
Change History (6)
comment:1 by , 11 years ago
Type: | Uncategorized → New feature |
---|
comment:2 by , 11 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
comment:3 by , 11 years ago
Patch needs improvement: | set |
---|
comment:4 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:5 by , 11 years ago
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
I added a test and documentation for this new feature.
My pull request is here: https://github.com/django/django/pull/2275
All tests pass under SQLite. This was my first time contributing to the Django project and I think I did everything correctly but if there's anything 'off' please let me know. Thanks.