I'm trying to add some extra attributes to a user by way of a User Profile in Django (1.2.5, the version supplied in Ubuntu natty), but whenever I create a new user through the admin console, with one of the new attributes included (eg, 'phone'), I get a "column user_id is not unique" IntegrityError.
I see that other people have had this problem, and they seem to have solved it by adding a unique dispatch_uid to the userprofile creation signal, but that's not working for me:
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.OneToOneField(User)
phone = models.CharField(max_length=40,blank=True,null=True)
def create_user_profile(sender, instance, **kwargs):
UserProfile.objects.get_or_create(user=instance)
post_save.connect(create_user_profile, sender=User, dispatch_uid="users-profilecreation-signal")
AUTH_PROFILE_MODULE is set to point at this class, in settings.py.
Anyone know what I'm doing wrong?