Hey! I am trying to add additional fields to the default User model. I had a look around the internet and done something like this:
Made a new model named UserProfile with the following in /UserProfile/models.py:
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
# This is the only required field
user = models.ForeignKey(User, unique=True)
# The rest is completely up to you...
favorite_band = models.CharField(max_length=100, blank=True)
favorite_cheese = models.CharField(max_length=100, blank=True)
lucky_number = models.IntegerField()
And added:
AUTH_PROFILE_MODULE = "newSite.userprofile"
To the settings, I also added "UserProfile" to the INSTALLED_APPS as to run sqlall.
The only problem is when I try the following in the shell:
>>> from django.contrib.auth.models import User
>>> user = User.objects.get(username = "user01")
>>> user.get_profile()
I get the following error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 367,in get_profile
raise SiteProfileNotAvailable('Unable to load the profile '
SiteProfileNotAvailable: Unable to load the profile model, check AUTH_PROFILE_MODULE in your project settings
Any help to solve this problem is appreciated!