KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have two models, each has a shared ManyToMany, using the db_table field. But how do I prevent syncdb from attempting to create the shared table, for the second model? class Model1(models.Model): othermodels = ManyToManyField('Model2', db_table='model1_model2', related_name='model1_model2') class Model2(models.model): othermodels = ManyToManyField('Model1', db_table='model1_model2', related_name='model2_model1') It's working great in my dev environment, because some of the tables got created piecemeal, as I built it all out. But from an empty database, syncdb throws: _mysql_exceptions.OperationalError: (1050, "Table 'model1_model2' already exists") Is there a flag that I'm missing from the second model's field to prevent duplicate table creation? Or am I just doing this entirely wrong?
Tags (comma-separated)
Save Edits
Cancel