Search code examples
djangoadminverbose

verbose name app in django admin interface


In the Django administration Interface, we have our models grouped by app. Well, I known how to customize the model name:

class MyModel (models.Model):
  class Meta:
    verbose_name = 'My Model'
    verbose_name_plural = 'My Models'   

But I couldn't customize the app name. Is there any verbose_name for the apps ?


Solution

  • Since django 1.7 app_label does not work. You have to follow https://docs.djangoproject.com/en/1.7/ref/applications/#for-application-authors instructions. That is:

    1. Create apps.py in your app's directory
    2. Write verbose name :

      # myapp/apps.py
      
      from django.apps import AppConfig
      
      class MyAppConfig(AppConfig):
          name = 'myapp'
          verbose_name = "Rock ’n’ roll"
      
    3. In the project's settings change INSTALLED_APPS :

      INSTALLED_APPS = [
          'myapp.apps.MyAppConfig',
          # ...
      ]
      

      Or, you can leave myapp.appsin INSTALLED_APPS and make your application load this AppConfig subclass by default as follows:

      # myapp/__init__.py
      
      default_app_config = 'myapp.apps.MyAppConfig'
      

    alles :)