class AB(models.Model):
    a = models.ForeignKey(A)
    b = models.ForeignKey(B)
    c = models.IntegerField(default=0)
    d = models.FloatField(default=0)
    e = models.IntegerField(default=0)
    f = models.FloatField(default=0)
    class Meta:
        unique_together = (('a', 'b'),)

I have a class like above.
when I call get_or_create, sometimes IntegrityError: (1062, "Duplicate entry) 
error happens.
a, _ = AB.objects.get_or_create(a=a, b=b)

I really have googled and worked on it for a while, but still nothing.
anyone can help?
Thanks in advance.

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