Hi all.
When I develop the custom user with profile, there is an error.
I do like 
http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/
create the app: account
in account/models.py
#####
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save

class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
    url = models.URLField("Website", blank=True)
    company = models.CharField(max_length=50, blank=True)

def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)

in the settings.py
#####
AUTH_PROFILE_MODULE = "account.UserProfile"

and i also do the syndb, and there indeed account_userprofile table in
database.

but when I run this code:
from django.contrib.auth.models import User
users = User.objects.all()
user = users[0]
user.get_profile()

where will be error like this:
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "E:\python25\lib\site-packages\django\contrib\auth\models.py",
line 380, 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

and i think the models.get_model function throw the exception.
Anyone can help me? thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to