summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/db/models/base.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 2444c22b01..80d98b1399 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1687,6 +1687,10 @@ class Model(six.with_metaclass(ModelBase)):
)
for f in cls._meta.local_many_to_many:
+ # Skip nonexistent models.
+ if isinstance(f.remote_field.through, six.string_types):
+ continue
+
# Check if auto-generated name for the M2M field is too long
# for the database.
for m2m in f.remote_field.through._meta.local_fields: