Ticket #10647: managedm2m_v2.diff

File managedm2m_v2.diff, 701 bytes (added by jbronn, 6 years ago)

Omit ManyToMany table creation only if both fields are managed.

  • django/db/backends/creation.py

     
    140140        "Return the CREATE TABLE statments for all the many-to-many tables defined on a model"
    141141        output = []
    142142        for f in model._meta.local_many_to_many:
    143             output.extend(self.sql_for_many_to_many_field(model, f, style))
     143            if model._meta.managed or f.rel.to._meta.managed:
     144                output.extend(self.sql_for_many_to_many_field(model, f, style))
    144145        return output
    145146
    146147    def sql_for_many_to_many_field(self, model, f, style):
Back to Top