The error you are getting has something to do with your user field in
the Venue model, which based from your models cannot be null. How are
you associating a user to it?


On Mar 25, 7:45 pm, shofty <[email protected]> wrote:
> I've got the following models.
>
> class UserProfile(models.Model):
>     user = models.ForeignKey(User, unique=True)
>     phone_number = models.CharField(max_length=250)
>
>     def __unicode__(self):
>         return self.user.username
>
> class Venue(models.Model):
>     user = models.ForeignKey(UserProfile)
>     name = models.CharField(max_length=250, default=False)
>     slug = models.CharField(max_length=250, unique=True)
>     phone_number = models.CharField(max_length=25, default=False)
>     web_address = models.CharField(max_length=100, default=False)
>
>     def __unicode__(self):
>         return self.name
>
> class Survey(models.Model):
>     name = models.CharField(max_length=250, default=False)
>     venue = models.ForeignKey(Venue)
>
>     def __unicode__(self):
>         return self.name
>
> when i try and save the new Venue i get
>
> Exception Type: IntegrityError
> Exception Value: survey_venue.user_id may not be NULL
>
> I'm using a form to save the venue and populating slug user at
> savetime
>
> what i cant work out is why i get the error i get. i can't see why it
> would want to try and populate the survey at the same time, its the
> wrong end of the FK relationship, isn't it?

-- 
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