Hi,
I am trying to create multiple types of users in my django e-commerce project by extending built-in Django user model but I am having issue.from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
type_choices = (
('Supplier', 'Supplier'),
('Designer', 'Designer'),
('Shop', 'Shop'),
('Referrer', 'Referrer'),
('User', 'User'),
)
user_type = models.CharField(max_length=2,
choices=type_choices,
default='User')
class UserDetails(models.Model):
type = models.OneToOneField(CustomUser)
extra_info = models.CharField(max_length=200)
AUTH_USER_MODEL = 'accounts.Customer'
Error:
ERRORS:
accounts.CustomUser.groups: (fields.E304) Reverse accessor for 'CustomUser.group
s' clashes with reverse accessor for 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'Custo
mUser.groups' or 'User.groups'.
accounts.CustomUser.user_permissions: (fields.E304) Reverse accessor for 'Custom
User.user_permissions' clashes with reverse accessor for 'User.user_permissions'
.
HINT: Add or change a related_name argument to the definition for 'Custo
mUser.user_permissions' or 'User.user_permissions'.
auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with
reverse accessor for 'CustomUser.groups'.
HINT: Add or change a related_name argument to the definition for 'User.
groups' or 'CustomUser.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permis
sions' clashes with reverse accessor for 'CustomUser.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.
user_permissions' or 'CustomUser.user_permissions'.
ERRORS:
accounts.CustomUser.groups: (fields.E304) Reverse accessor for 'CustomUser.group
s' clashes with reverse accessor for 'User.groups'.
HINT: Add or change a related_name argument to the definition for 'Custo
mUser.groups' or 'User.groups'.
accounts.CustomUser.user_permissions: (fields.E304) Reverse accessor for 'Custom
User.user_permissions' clashes with reverse accessor for 'User.user_permissions'
.
HINT: Add or change a related_name argument to the definition for 'Custo
mUser.user_permissions' or 'User.user_permissions'.
auth.User.groups: (fields.E304) Reverse accessor for 'User.groups' clashes with
reverse accessor for 'CustomUser.groups'.
HINT: Add or change a related_name argument to the definition for 'User.
groups' or 'CustomUser.groups'.
auth.User.user_permissions: (fields.E304) Reverse accessor for 'User.user_permis
sions' clashes with reverse accessor for 'CustomUser.user_permissions'.
HINT: Add or change a related_name argument to the definition for 'User.
user_permissions' or 'CustomUser.user_permissions'.
Please advise.
Regards,
Shazia
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD83tOxKnQCeWyWjYmbxo7iaxmsysk8WJs-zy44GZbDXr93iEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment