Is my way of extending the auth.models.User of django correct? should I inherit from AbstractUser
or User
?
Here is the way I am implementing it now: but should I consider having a OneToOneField connecting to the User table from UserProfile?
from django.contrib.auth.models import User
PHONE_LENGTH = 13
NAME_LENGTH = 100
###########################
### User Profile
###########################
class UserProfile(User):
""" inherits from AbstractUser in Django - mainly used for authentication"""
# other fields here
phone = models.CharField(max_length=PHONE_LENGTH) #optional
mobile = models.CharField(max_length=PHONE_LENGTH) #requried
# foreign key
subscription_type = models.ForeignKey(SubscriptionType)
def __str__(self):
return "%s's profile" % self.user