eos87
eos87

Reputation: 9363

How to set another Inline title in Django Admin?

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?

Upvotes: 59

Views: 28069

Answers (1)

odedfos
odedfos

Reputation: 4619

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"

Upvotes: 118

Related Questions