summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAkis Kesoglou <akis@radial.gr>2014-08-29 17:01:21 +0300
committerTim Graham <timograham@gmail.com>2014-08-30 07:14:44 -0400
commit6613ea6e3ff2597c04db35ef885562e95c1ef012 (patch)
treee9b921cb98e2115cfa13eca03a8dfb2d636fc1e4 /django
parent66757fee7e921ad4c35e0b3f80c25e026100b31c (diff)
Fixed #23370 -- defer() + select_related() crashed with inherited models.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/query.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index aa55b76322..f96cce2713 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1343,12 +1343,12 @@ def get_klass_info(klass, max_depth=0, cur_depth=0, requested=None,
init_list = []
# Build the list of fields that *haven't* been requested
for field, model in klass._meta.get_concrete_fields_with_model():
- if field.name not in load_fields:
- skip.add(field.attname)
- elif from_parent and issubclass(from_parent, model.__class__):
+ if from_parent and model and issubclass(from_parent, model):
# Avoid loading fields already loaded for parent model for
# child models.
continue
+ elif field.name not in load_fields:
+ skip.add(field.attname)
else:
init_list.append(field.attname)
# Retrieve all the requested fields