admin_order_field for Admin list_display not working for callable
|Reported by:||kegan||Owned by:||brosner|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
In the Admin, when using list_display, we should be able to make a sort callable if it is associated with certain database field through the use of attribute admin_order_field. Example:
def submitted_date(self, obj): return obj.created_at.strftime('%d %b %Y') submitted_date.short_description = 'Submitted Date' submitted_date.admin_order_field = 'created_at'
NOTE: created_at is a DB field in the model.
This is currently not working.
Searching through the code, I believe the bug is located in the following Django code. The attr variable seems will always be None.
Change History (9)
comment:1 in reply to: ↑ description ; follow-up: ↓ 3 Changed 6 years ago by ramiro
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 6 years ago by kmtracey
- milestone set to 1.2
- Triage Stage changed from Unreviewed to Accepted
comment:5 Changed 6 years ago by brosner
- Owner changed from nobody to brosner
- Status changed from new to assigned
comment:8 Changed 5 years ago by brosner
- Resolution set to fixed
- Status changed from assigned to closed