0

I've created a custom user model using abstractuser titled employee.

class Employee(AbstractUser):

username = models.CharField(max_length = 30)
first_name = models.CharField(max_length = 30)
last_name = models.CharField(max_length=30)
email = models.CharField(max_length=255)
password = models.CharField(max_length=30)
user_type = models.ForeignKey('UserProfile', null = True)
status = models.CharField(max_length = 30, default='Not Verified',)

def __str__(self):
    return self.first_name + ' ' + self.last_name

That is my models.py pertaining to Employee

On the Admin page I see this - Admin Page

Learningsys is my app name.

How do I make it so that I see ''Employee or preferably 'Employees' under my app name instead of 'Users' and why does it show Users in the first place? I suspect it is because I am technically creating a 'Custom User' but would like clarification regardless.

Thanks,

Rohan.

Rohan G
  • 13
  • 3

1 Answers1

0

You need to use verbose_name_plural meta option to change model's plural name on admin page:

class Employee(AbstractUser):
    ...
    class Meta:
        verbose_name_plural = 'Employees'

The default value of verbose_name_plural for AbstractUser is users so you inherited it with other AbstractUser's properties.

neverwalkaloner
  • 46,181
  • 7
  • 92
  • 100
  • 1
    Thanks a lot, this worked. I had tried verbose_name_plural outside Meta (didn't create a Meta class) but in hindsight that was silly. – Rohan G Jun 07 '18 at 12:23