I know I can change the display title for a model in Django Admin using
class Meta:
verbose_name='Custom Model Name Here'
However, is there a way to display which app heading a model is displayed under?
For example, if I create a custom user model Users
in a new app also called users
then the default user model goes from Authentication and Authorization > Users
to Users > Users
.
I would like to retain it under the original heading Authentication and Authorization > Users
.
I have read this answer which suggests changes the app verbose_name
, however it only changes the verbose name of the app associated with the model. I want to show the model in a different group on the admin panel. You can see the issue that approach takes here:
There is no simple way of doing what you're intending, check out the Django code/template that generates the view:
templates/admin/index.html
:As you can see, Django admin template is looping your app_list directy, so the only way of doing it would be to override the
admin/index.html
template to place your models in your desired order.From Django docs:
https://docs.djangoproject.com/en/2.2/ref/contrib/admin/#overriding-vs-replacing-an-admin-template