Specifying "through" instead of "db_table" did not raise any errors, but it caused the relevant field in the admin change form to disappear!
On Apr 3, 4:52 pm, Karen Tracey <kmtra...@gmail.com> wrote: > On Fri, Apr 3, 2009 at 4:25 PM, Andrew G. <agross...@gmail.com> wrote: > > > The following code in a fresh project/app will cause the database > > creation to fail. > > > class Position(models.Model): > > description = models.CharField(max_length=20, blank=True, > > null=True) > > parts = models.ManyToManyField('Part', db_table='part_positions') > > > class PartPosition(models.Model): > > rule_id = models.IntegerField(primary_key=True, editable=False) > > part = models.ForeignKey('Part') > > position = models.ForeignKey('Position') > > > class Meta: > > db_table = 'part_positions' > > > class Part(models.Model): > > description = models.CharField(max_length=20, blank=True, > > null=True) > > positions = models.ManyToManyField('Position', > > db_table='part_positions') > > I think you want to be specifying "through" the PartPosition model, not > directly specifying the db_table for that model, on your ManyToMany fields: > > http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-o... > > When you specify "db_table" the database creation code still thinks it needs > to create the model, when you specify "through" another model it knows the > table will be created when that model is processed. > > Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---