Changing clickable field in Django admin list_display

In Django 1.8.6, by default, every time I provide a list_display parameter for a subclass of ModelAdmin, the first field in the list becomes interactive and leads to an object edit page.

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

I currently have an id field that can be clicked (it starts first in list_display ), which is a bit small. I would like to click, name to go to the edit page.

+11
python django django-models django-admin django-forms
Nov 09 '15 at 19:06
source share
1 answer

You can look at django.contrib.admin.ModelAdmin.list_display_links

Mainly used as

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

Hope this helps :)

+28
Nov 09 '15 at 19:14
source share



All Articles