Sometimes we are able to click on the column then the table will be sorted by what's clicked BUT some are not clickable and I do believe those none clickable are because it's not the fields in the model that it's either a foreign key or M2M
I am wondering if there's a way to make them clickable to sort too?
for example of the following,
title and created_at are clickable but not SET
Thanks in advance for any suggestions and help.
I'm just guessing your models, but you get the idea.
def ModelAdmin(admin.ModelAdmin):
list_display = ('title', 'set', 'created_at')
def set(self, obj):
return obj.set
set.admin_order_field = 'set__name'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With