Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 634
eos87 Avatar asked Jan 26 '11 17:01

eos87


People also ask

What is Admin ModelAdmin in Django?

One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization's internal management tool.

What is admin interface in Django?

Django provides a default admin interface which can be used to perform create, read, update and delete operations on the model directly. It reads set of data that explain and gives information about data from the model, to provide an instant interface where the user can adjust contents of the application .

What we can do in admin portal in Django?

Overview. The Django admin application can use your models to automatically build a site area that you can use to create, view, update, and delete records. This can save you a lot of time during development, making it very easy to test your models and get a feel for whether you have the right data.


1 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" 
like image 135
odedfos Avatar answered Sep 18 '22 04:09

odedfos