2

I have a question about django's user inheritance.

I have gone through docs of django where I have seen inheritence of User model if I want to register the user through email and password.

My questions :

What will be the difference on default User model and Custom User model that I will make ? Can I use the permissions and add group in the Custom User model ?

And also what if I want to inherit django's default User in my model ?

class Person(User):
    address = models.CharField(max_length=100)
    def __unicode__(self):
        return self.address

Here the user model is django's default User model ? Can I inherit like that ?

gamer
  • 5,673
  • 13
  • 58
  • 91

1 Answers1

2

based on django specifying a custom user model

The easiest way to construct a compliant custom User model is to inherit from AbstractBaseUser. AbstractBaseUser provides the core implementation of a User model, including hashed passwords and tokenized password resets.

Alse Extending the existing User model can be a good option.

Hasan Ramezani
  • 5,004
  • 24
  • 30