On Thu, Nov 26, 2009 at 9:37 AM, cerberos <pe...@whywouldwe.com> wrote:

> I have a model that has two fields (Django 1.1.1)
>
> class FooBar(models.Model):
>    foo = models.ForeignKey('Foo')
>    bar = models.ForeignKey('Bar')
>
>    class Meta:
>        unique_together = (('foo','bar'),)
>
> When is_valid is called in my view and the combination of fields
> already exists (eg unique_together is false) the error returned is
> "Foo bar with this None and None already exists."
>
> "None and None" seems like a bug to me, but I'm not sure.


I've seen that kind of error, too and found various references to it when I
searched.  In my case, the problem was an extraneous comma in the code,
which wasn't picked up as a syntax error... which bothers me.  Django seems
to fail to surface some syntax errors and either produces no results or some
other error.

What I think this generally means is that in your view, the object isn't
getting initialized for some reason.  I'm assuming that you get the error
when you try to save.  I'd carefully go over whatever initializes or sets
the data.

Nick

--

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


Reply via email to