Rename Apps in Django Admin

Rename Apps in Django Admin

Posted: 5 years ago in  Python | Django |


Since Django 1.7, there is feature to define app's name different from the name used when run startapp


In this example, we create app blogapp, the Django admin will display Blogapp, not a pretty name

Here is guide to rename it for app author and developer who reuse the app

For app author:

Create apps.py in blogapp

from django.apps import AppConfig

class BlogAppConfig(AppConfig):
    name = 'blogapp'
    verbose_name = "Blog"

Modify __init__.py to add this line

default_app_config = "blogapp.apps.BlogAppConfig"

In settings.py, put blogapp in INSTALLED_APP and you will see Blog as app's name in Django admin

For developer reuse the app:

A developer reuse the blogapp can also override the "Blog" with different name

Let say they create a project with name anotherproject.

Create apps.py in the project folder:

from blogapp.apps import BlogAppConfig

class CustomBlogAppConfig(BlogAppConfig):
    verbose_name = "Custom Name For Blog"

In settings.py, add "anotherproject.apps.CustomBlogAppConfig" instead of "blogapp" to INSTALLED_APP

Now you have an admin with nice and customized app's names