Home > Software design >  Is it possible to rename the application's group name in Django?
Is it possible to rename the application's group name in Django?

Time:04-30

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.

CodePudding user response:

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'
  • Related