This error is occur when you're saving the member, not the user. When creating the member, you are not assigning the user.
On Wed, Apr 17, 2013 at 10:45 AM, sachin <[email protected]> wrote: > I m still stuck with > > Exception Type: IntegrityError > Exception Value: column user_id is not unique > > Whenever I try to save, it throws the above error. > > I have attached files for reference, can someone help ?? > > > > On Saturday, April 6, 2013 7:07:32 PM UTC+5:30, sachin wrote: >> >> Thanx Shawn, >> * >> * >> UserCreationForm really helped. >> >> Now I have a different problem, I'm trying to add custom feilds to *auth >> user *using >> storing-additional-**information-about-users<https://docs.djangoproject.com/en/1.4/topics/auth/#storing-additional-information-about-users> >> . >> But now I m getting this error. >> >> Exception Type:IntegrityErrorException Value: >> >> column user_id is not unique >> >> >> >> This is my *models.py *file: >> * >> * >> 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) >> sr_no = models.CharField(max_length=**10) >> >> def __unicode__(self): >> return self.sr_no >> >> def create_user_profile(sender, instance, created, **kwargs): >> if created: >> UserProfile.objects.create(**user=instance) >> >> post_save.connect(create_user_**profile, sender=User) >> >> I have added *unique *field, but it does not make any difference. So far >> I haven't got >> any convincing answer. >> >> Any Idea ?? >> On Tuesday, April 2, 2013 12:49:52 AM UTC+5:30, Shawn Milochik wrote: >>> >>> Don't even worry about factories. They're for when you want a bunch of >>> forms for the same model on the page at once. >>> >>> Use the UserCreationForm in django.contrib.auth.forms. It only accepts >>> a username and password, so you can either subclass it to add the >>> fields or make your own form and add it to your view so that they both >>> appear in the same HTML form. You can validate both and do what you >>> need to do. >>> >>> You definitely shouldn't be writing validation logic for the password >>> and username and such -- that's what ModelForms are for. >>> >>> If you have more specific questions just ask. >>> >> -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.

