Hey guys, I'm trying to extend the User class to add some additional
information to user's profiles. I've been reading
http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model
for some information, but I don't think the blog post really explains
how to get it fully working. What I'm currently doing is this...

When I create a user, I do the following lines, and then it get to the
profile callback function...

        # Create the user.
        new_user = User.objects.create_user(username, email, password)
        new_user.first_name = firstname
        new_user.is_active = False
        new_user.save()

        # And finally create the registration profile.
        registration_profile = self.create_profile(new_user)

        # Create site-specific profile, if specified.
        if profile_callback is not None:
            profile_callback(user=new_user)


My profile callback functions looks like so...

from mysite.apps.profile import models

def CreateExtendedProfile(user):
    user = models.ExtendedUserProfile()
    user.save()
    return


The extended profile looks like..

from django.db import models
from django.contrib.auth.models import User

class ExtendedUserProfile(models.Model):
    home_state = models.USStateField(blank=True)
    user = models.ForeignKey(User, unique=True)


I do have AUTH_PROFILE_MODULE properly pointing to this. This here
gets an error when calling CreateExtendedProfile, saying that user_id
cannot be null. Is this not the proper way to do this?

Thanks


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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