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:16:47 -0400
commitb877697472073454423a0cdff695387d9039b464 (patch)
tree4c4cc634af45e61871876ebc49f24725cfb0f4f1 /django
parentce4057591adac537038736ee41d084e08eea553e (diff)
[1.6.x] Fixed #23370 -- defer() + select_related() crashed with inherited models.
Backport of 6613ea6e3f from master
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 48a7ffbbf1..334533551b 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1198,12 +1198,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