Configure the display name of the self-built app (application) in Django and the name of the System app Admin and Auth

Source: Internet
Author: User
Tags auth

There are many articles on the web saying that adding a field in models.py to modify the app name, I tried the 1.8 version. See the official documentation for instructions,

The following changes are more reliable.


Refer to Configuring Applications description in https://docs.djangoproject.com/en/1.8/ref/applications/.

Here's a demonstration of creating an application inventory

Step 1. In the __init__.py that applies inventory, add the code

admin, auth

admin.default_app_config = ' inventory.admin.AdminConfig '
auth.default_app_config = ' Inventory.admin.AuthConfig '
default_app_config = ' Inventory.admin.InventoryConfig '

Step 2. Add code in the admin.py that applies inventory,

  from  django.contrib  Import  admin  from  Django.contrib.auth.apps  Import  authconfig  as  _authconfig  from  Django.contrib.admin.apps  Import  adminconfig  as  _adminconfig  from  django.apps  Import  AppConfig  from  inventory  import  Models  class  Authconfig (_authconfig): name = ' Django.contrib.auth ' verbose_name = U ' user Management ' 
  
   class  Adminconfig (_adminconfig): name = ' django.contrib.admin ' verbose_name = U ' background management ' 
    Clas S  inventoryconfig (AppConfig): name = U ' inventory ' verbose_name = U ' Inventory module Management ' 
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.