Take the following models:

class Person(models.Model):
    name = models.CharField(_('Person'), max_length=255)

class Production(models.Model):
    person = models.ForeignKey(Person)
    title = models.CharField(_('Title'), max_length=255)

    class Meta:
        unique_together = (('person', 'title'),)


Create a Person named "Bob", then create a view with an inline model
formset (I used the factory function) for the Production. Then, using
the inline forms in the Production formset, add a couple of Production
objects, one with the title "One", and one with the title "Two". After
you save them, edit the title fields of "One" and "Two" to change the
values to "Two" and "One", respectively. Upon attempting to save,
you'll receive an error message stating, "Production with this Person
and Title already exists."

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

Reply via email to