Currently I created another class/table called MyAppUser with my custom columns (such as address and phone number) that has a foreign key to Django’s authentication User.
Something like this
from django.db import models
from django.contrib.auth.models import User
class MyAppUser( models.Model ) :
def __unicode__( self ) :
return self.user.username
user = models.ForeignKey( User )
comment = models.TextField( blank = True )
phone = models.CharField( max_length = 135, blank = True )
Is the above method a good practice? Or should I try to modify the auth_user directly? And if so, how would I do that?
Bonus question: Is there a way to have both my custom table to be called User as well? I thought about trying from django.contrib.auth import models, then calling models.User, but then I think that would conflict with django.db.models as well. Maybe I need to try from django.contrib.auth.models import User as AuthUser? Is this a good idea?
Django provides built-in support for extending the user with your own properties, called User Profiles.