summaryrefslogtreecommitdiff
path: root/django/db/backends/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/schema.py')
-rw-r--r--django/db/backends/schema.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
index 7c10db7dec..12e2ab7657 100644
--- a/django/db/backends/schema.py
+++ b/django/db/backends/schema.py
@@ -3,7 +3,6 @@ import operator
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.utils import truncate_name
-from django.db.models.fields.related import ManyToManyField
from django.db.transaction import atomic
from django.utils.encoding import force_bytes
from django.utils.log import getLogger
@@ -359,7 +358,7 @@ class BaseDatabaseSchemaEditor(object):
table instead (for M2M fields)
"""
# Special-case implicit M2M tables
- if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
+ if field.get_internal_type() == 'ManyToManyField' and field.rel.through._meta.auto_created:
return self.create_model(field.rel.through)
# Get the column's definition
definition, params = self.column_sql(model, field, include_default=True)
@@ -403,7 +402,7 @@ class BaseDatabaseSchemaEditor(object):
but for M2Ms may involve deleting a table.
"""
# Special-case implicit M2M tables
- if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
+ if field.get_internal_type() == 'ManyToManyField' and field.rel.through._meta.auto_created:
return self.delete_model(field.rel.through)
# It might not actually have a column behind it
if field.db_parameters(connection=self.connection)['type'] is None: