I am trying to create a custom profile to add additional fields to django-registration
. Here is the code I have so far --
in models.py
from django.db import models
from django.contrib.auth.models import User
class Profile(models.Model):
user = models.ForeignKey(User, unique=True)
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
email = models.CharField(max_length=50)
password = models.CharField(max_length=50)
and in settings.py
AUTH_PROFILE_MODULE = 'myproject.Profile'
However, I am getting the following error when I try to use create_user(). Here is what happens when I type it into the interpreter --
>>> from django.contrib.auth.models import User
>>> User.objects.create_user(first_name='tom',last_name='smith',email='ts@gmail.com',password='hello')
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: create_user() got an unexpected keyword argument 'first_name'
What am I missing in order for create_user()
to recognize these new columns? Thank you.