Ticket #10767: check-through-model-for-managed.diff

File check-through-model-for-managed.diff, 1.2 KB (added by Trevor Caira, 16 years ago)
  • django/db/backends/__init__.py

     
    497497                if not model._meta.managed:
    498498                    continue
    499499                tables.add(model._meta.db_table)
    500                 tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many])
     500                tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many if f.rel.through is None or f.rel.through_model._meta.managed])
    501501        if only_existing:
    502502            tables = [t for t in tables if self.table_name_converter(t) in self.table_names()]
    503503        return tables
     
    530530                        break # Only one AutoField is allowed per model, so don't bother continuing.
    531531
    532532                for f in model._meta.local_many_to_many:
    533                     sequence_list.append({'table': f.m2m_db_table(), 'column': None})
     533                    if f.rel.through is None or f.rel.through_model._meta.managed:
     534                        sequence_list.append({'table': f.m2m_db_table(), 'column': None})
    534535
    535536        return sequence_list
    536537
Back to Top