0

I'm working with Django, and I use my own customized User Class, just like this:

class Company(User):
    objects = UserManager()

All works as expected, but in the admin, it shows the name of the class as User, not Company, as shown in this image below:

Class Company in admin

It's just the tag, all works correctly, but I wanted to know if there's a way to change the tag to Company, not Users. Thanks for helping.

lluisu
  • 367
  • 1
  • 5
  • 19

2 Answers2

3

You can use the verbose_name attribute in django models. verbose_name_plural can be used to define any plural attribute

class Company(User):
    objects = UserManager()
    class Meta:
        verbose_name = "Company"
        verbose_name_plural = "Companies"
karthikr
  • 97,368
  • 26
  • 197
  • 188
0

As described in this topic: Verbose name for admin model Class in django

You need to use a subclass Meta and set its verbose_name attribute:

class Company(User):
    objects = UserManager()

    class Meta:
        verbose_name = "Company"
Community
  • 1
  • 1
Bruno A.
  • 1,765
  • 16
  • 17