How to add the auto primary key into django's admin list_display

django, django-admin, primary-key

Solution

The automatically created primary key field works just like any other field, except that you don't have to specify it. Unless you've changed the name, this should be as simple as:

list_display = ['id', ...]

I haven't checked on whether or not the `pk` alias works everywhere that the admin expects field names. UPDATE: the `pk` alias is accepted instead of `id`

Problem

Is it possible to include the automatically created primary key into the list_display of the admin site? I might also need to include that primary key into the links field on the display page. Any idea? Thanks in advance.

Original source