26

In Django 1.8.6, by default, whenever I provide a list_display option to a ModelAdmin subclass, the first field in the list becomes clickable and leads to the object edit page.

Is there a way to keep the order of the fields in list_display, but change the clickable one?

Currently, I have the id field clickable (it goes first in list_display), which is a tad small. I would like to better click on, say, name to go to the edit page.

1 Answer 1

97

You could have a look at django.contrib.admin.ModelAdmin.list_display_links

Basically it is used like

class PersonAdmin(admin.ModelAdmin):
    list_display = ('first_name', 'last_name', 'birthday')
    list_display_links = ('first_name', 'last_name')

Hope this will help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.