Duplicate create for join table from ManyToMany using explicit "through=Model.field.through"

14 views
Skip to first unread message

Brock Brandenberg

unread,
Feb 8, 2012, 12:23:07 PM2/8/12
to South Users
Hello.

South newbie here. Glad to have found South. Was getting really tired
of manually reconciling model changes in the db.

I'm primarily using Django's admin, and I'm using a documented trick
to make the nice multiple choice widget show up on both sides of a
many-to-many relationship (the join table is explicitly named, but
that doesn't seem to make a difference):

class Item(models.Model):
tags =
models.ManyToManyField('Tag',related_name='1+',db_table='item_tags')

class Tag(models.Model):
items = models.ManyToManyField(Item, through=Item.tags.through,
related_name='1+')

South is properly generating the sql for all three tables, but I'm
getting duplicate creates and deletes for the join table (with the
only minor difference being the order of the field creation within the
duplicates). I'm manually removing the duplicate sql statements, but
it's probably a good case for South to handle because it did it in the
original conversion and does it in any new migrations that I create.

Thanks,
Brock Brandenberg

Andrew Godwin

unread,
Feb 8, 2012, 12:27:17 PM2/8/12
to south...@googlegroups.com

I actually think we already have a bug for this open in Trac. I
certainly remember hearing about a similar issue recently.

Not much I can offer as an immediate fix other than what you're already
doing, I'm afraid...

Andrew

Brock Brandenberg

unread,
Feb 8, 2012, 2:20:53 PM2/8/12
to South Users
Thanks Andrew. I didn't find it in a search, so I'm glad you have some
record of it.

Brock
Reply all
Reply to author
Forward
0 new messages