How to set another Inline title in Django Admin?

Question:

I need to change the inline title to something else other than the verbose_name of the class Meta in the model. Is there an attribute to achieve this?

Asked By: eos87

||

Answers:

As documented, you need to set the values of your InlineModelAdmin subclass:

InlineModelAdmin.verbose_name –
An override to the verbose_name found in the model’s inner Meta class.

InlineModelAdmin.verbose_name_plural –
An override to the verbose_name_plural found in the model’s inner Meta class.

In this example, instead of the title ‘Device’ we use ‘Phone’:

class DeviceInline(admin.TabularInline):
    model = Device
    verbose_name = "Phone"
    verbose_name_plural = "My Phones"
Answered By: odedfos