summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2017-04-19 10:24:22 +0200
committerClaude Paroz <claude@2xlibre.net>2017-04-19 19:37:13 +0200
commit61e883c7c268f3460a85be1c66ea1773711cd6c7 (patch)
treedbecd119fdc40a1dd6efd99dfd2f128be04d48c3 /django
parentcf1e682c8c68d7187c34f46f2717b22f830d92a1 (diff)
[1.11.x] Fixed #28096 -- Allowed prefetch calls with ModelIterable subclasses
Regression in 7ec330eeb96d0874949eacb8ed1bbb97e11807e1. Thanks Tim Graham for the review. Backport of 43b4a1618ed85151494d68778a1bb6304ce1cb79 from master.
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 f9534f3700..5069c419d1 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1305,7 +1305,7 @@ class Prefetch(object):
self.prefetch_through = lookup
# `prefetch_to` is the path to the attribute that stores the result.
self.prefetch_to = lookup
- if queryset is not None and queryset._iterable_class is not ModelIterable:
+ if queryset is not None and not issubclass(queryset._iterable_class, ModelIterable):
raise ValueError('Prefetch querysets cannot use values().')
if to_attr:
self.prefetch_to = LOOKUP_SEP.join(lookup.split(LOOKUP_SEP)[:-1] + [to_attr])