summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 40faa545c8..0913399e2a 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -556,10 +556,10 @@ class Query(object):
# models.
workset = {}
for model, values in seen.iteritems():
- for field in model._meta.fields:
+ for field, m in model._meta.get_fields_with_model():
if field in values:
continue
- add_to_dict(workset, model, field)
+ add_to_dict(workset, m or model, field)
for model, values in must_include.iteritems():
# If we haven't included a model in workset, we don't add the
# corresponding must_include fields for that model, since an