Reputation: 77
Hey I have a model UserProfile
which has a OneToOneField relationship to the model User
. In the adminpage I use list_display
property to display some of the fields of UserProfile in the same place where User
is displayed. They are displayed well but unfortunately they are not sortable like the models from User
. I can click on the column heading in order to sort the columns which belong to User
but not the ones that are from UserProfile
how do you make them clickable and sortable?
Upvotes: 4
Views: 10685
Reputation: 34553
You'll need to add the admin_order_field
property to your columns.
Upvotes: 8