ManyToManyField no syncdb

1
2
3
4
class ManyToManyField_NoSyncdb(models.ManyToManyField):
    def __init__(self, *args, **kwargs):
        super(ManyToManyField_NoSyncdb, self).__init__(*args, **kwargs)
        self.creates_table = False

Comments

dkg (on February 3, 2010):

Thanks, this was very useful to me, because i have m2m relationships that i want to look at from both directions.

In fact, it seems useful enough that it might be handy to have a creates_table argument to the built-in ManyToManyField (defaults to True), so this workaround wouldn't be necessary.

#

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.