57

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?

eos87
  • 8,961
  • 12
  • 49
  • 77
  • See docs: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.verbose_name – guettli Oct 12 '21 at 13:03

1 Answers1

115

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"
odedfos
  • 4,491
  • 3
  • 30
  • 42
  • 7
    In most views of Inlines `verbose_name_plural` is used. – maciek Sep 12 '16 at 11:49
  • 3
    `verbose_name` changes the title of each inline, while `verbose_name_plural` changes the main title of all inlines. – raratiru Oct 09 '17 at 11:39
  • 5
    Hi @raratiru in my Django 2.1.3 the verbose_name doesn't work, the title of each inline is the __str__ of inline model. I'm still trying to find the way to change it. Do you or anybody know how? thanks! – C.K. Nov 29 '18 at 04:50
  • 2
    @C.K. Hallo, as far as the documentation is concerned, I see that this option [is still there.](https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.verbose_name). Probably it would be better to ask a new question where you could clearly illustrate all the details of the particular situation you are dealing with. – raratiru Nov 29 '18 at 11:34