Reputation: 755
I want to add second user model, not to customize built-in model. (For example, if the built-in model is "Customer", "Designer" is another model which I would make.)
It's because to allow signup, product publishing of "Designer" themselves.
I've searched how to write second user model, there was to add a second user model through inherits a second user model, but not explained for settings.py.
Should I add additional code such asAUTH_USER_MODEL = models.Designer
?
Upvotes: 0
Views: 58
Reputation: 45595
You can't have two user models in Django.
Use the built-in User
model and create "profile" models with OneToOne
relation to the User
:
class Customer(models.Model):
user = models.OneToOneField(User)
...
class Designer(models.Model):
user = models.OneToOneField(User)
...
In this case you can create any number of profile models and access to them from the User
instance will be as easy as:
customer = request.user.customer
designer = request.user.designer
Upvotes: 2