Change clickable field in Django admin list_display

12,034

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 :)

Share:
12,034

Related videos on Youtube

wh1t3cat1k
Author by

wh1t3cat1k

Updated on September 14, 2022

Comments

  • wh1t3cat1k
    wh1t3cat1k over 1 year

    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.