summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorPaulo <commonzenpython@gmail.com>2018-05-27 13:48:24 +0200
committerTim Graham <timograham@gmail.com>2018-05-27 21:45:51 -0400
commit6104875a2cc797bbd1254aa61f22a9b03d652128 (patch)
tree8f5ad727468d9f352d43a774c17fb08247357eda /django
parente0ff88be4f3a40d07d94d974c64a490d2ecb3e78 (diff)
Fixed #29230 -- Fixed nested prefetches that clash with descriptors.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/query.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 1ef20d01d9..5ae451879c 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1568,7 +1568,7 @@ def prefetch_related_objects(model_instances, *related_lookups):
# same relationships to stop infinite recursion. So, if we
# are already on an automatically added lookup, don't add
# the new lookups from relationships we've seen already.
- if not (lookup in auto_lookups and descriptor in followed_descriptors):
+ if not (prefetch_to in done_queries and lookup in auto_lookups and descriptor in followed_descriptors):
done_queries[prefetch_to] = obj_list
new_lookups = normalize_prefetch_lookups(reversed(additional_lookups), prefetch_to)
auto_lookups.update(new_lookups)