Search code examples
pythondjangodjango-modelsdjango-adminbackend

Change the table name of the Model in django admin


I want to change my django admin table name in django admin panel

I want to change the Products name in the top of that table, for example I want to change PRODUCTS and ACCOUNTS names in the picture below: django admin panel side menu

In the picture above I have Two model. first is the محصولات

and the second one is the نظرات

And also my app name is Products which is the shown in the table name. but I want to change this name. and if possible I want to change the other table names which is the "ACCOUNTS". I did change my model verbose_name and verbose_plural_name as you can saw, but I couldn't change the table name.


Solution

  • JFYI: In below image you can see white box highlighted is app name of Django and red highlighted box is model name of that app.

    change model name label in admin panel

    As per i'm getting your requirement, you have already change the label of your models in case more clarification you can do it by adding verbose_name in Meta class of your model

     class Meta:
        verbose_name = "حساب"
        verbose_name_plural = "custom model plural name"
    

    change app name label in admin panel

    Add verbose_name in your app's "apps.py"

    class YourAppConfig(AppConfig):
       name = 'your_default_app_label'
       verbose_name = "Custom App label for Admin panel"
    
    • By doing above change you can see that your app label(in image highlighted with white box) in admin panel has been changed

    enter image description here