Tuesday, July 26, 2011

unique_together in 1.2: does it need a syncdb and does it work when saving the model?

I added a meta option unique_together with 3 fields in a model:

unique_together = ("family_name", "given_names", "working_group")

To my surprise it worked without doing a syncdb. a sqldiff show no
difference and the check for uniqueness works when I create a new
instance, not when I update an existing one.

2 questions:

- do I need to update the database schema and how do I get the
appropriate SQL change/patch from Django?
- is the unique constraint supposed to work when updating an instance
as well as creating a new one?

Thanks

Fred

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate