Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to rename the application's group name in Django?

For example, you have "Groups" and "Users" under "AUTHORIZATION AND AUTHENTICATION" (or something named like that). If you make a new app and register its model, it's gonna write out the name of the application. I want to rename that in the admin.


1 Answers

You can do that in the verbose_name [Django-doc] of the AppConfig:

# app_name/apps.py

from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

class MyAppConfig(AppConfig):
    verbose_name = _('My verbose name for the app')

In the __init__.py of the app, you then specify this as the default AppConfig for that app:

# app_name/__init__.py

default_app_config = 'app_name.apps.MyAppConfig'
like image 185
Willem Van Onsem Avatar answered Oct 25 '25 21:10

Willem Van Onsem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!