From baff4dd37dabfef1ff939513fa45124382b57bf8 Mon Sep 17 00:00:00 2001 From: Andrew Nester Date: Thu, 30 Jun 2016 14:22:10 +0300 Subject: Fixed #25292 -- Fixed crash in ManyToManyField.through_fields check. --- django/db/models/base.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'django') 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: -- cgit v1.3