How to allow sorting in the Django admin by a custom list_display field, which doesn't have a DB fie
Posted
by Gj
on Stack Overflow
See other posts from Stack Overflow
or by Gj
Published on 2010-04-15T17:36:00Z
Indexed on
2010/04/17
4:23 UTC
Read the original article
Hit count: 248
django
|django-admin
I have a custom list_display field which is responsible for a column of integers in one of my admin pages.
I need to allow staff members to sort according to it.
There's a solution for how to acheive that if the integer represents a count/average/etc of some DB field, which is not the case for me.
[ the solution for that case is here: http://stackoverflow.com/questions/2168475/django-admin-how-to-sort-by-one-of-the-custom-list-display-fields-that-has-no-da ]
Any ideas how I can achieve this sorting without actually creating and maintaining a DB field for the values?
© Stack Overflow or respective owner