On Tue, Jul 26, 2011 at 4:09 AM, fjanon <fja...@gmail.com> wrote: > - 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?
unique_together creates a constraint in the database, so it would prevent any non-uniqueness, creating or updating. but, syncdb is the only way for Django to setup the database; and it won't modify existing tables. You have to choose between: - erasing your DB table and use syncdb to create it again - manually modifying the tables in the database with ALTER TABLE. you can use "manage.py sql" to see how the table should look like; but it won't generate the modifications for you. - South. There's also some limited model validations that do block some inconsistencies before hitting the database, that might be why it works for new instances (although i'm sure you could find some cases that it wouldn't catch). But ultimately, all data consistency is supposed to be done by the database. -- Javier -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.