fix error with empty querysets and wrapped prefetch_related
This commit is contained in:
parent
afe532f150
commit
bd5e0ca264
1 changed files with 1 additions and 1 deletions
|
@ -308,7 +308,7 @@ class BaseQueryWrapper(BaseWrapper):
|
|||
This makes sure that the prefetch also happens on the virtually modified database.
|
||||
"""
|
||||
lookups_qs = {tuple(lookup.prefetch_through.split('__')): lookup.queryset for lookup in lookups
|
||||
if isinstance(lookup, Prefetch) and lookup.queryset}
|
||||
if isinstance(lookup, Prefetch) and lookup.queryset is not None}
|
||||
for qs in lookups_qs.values():
|
||||
if not isinstance(qs, QuerySetWrapper):
|
||||
raise TypeError('Prefetch object queryset needs to be wrapped!')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue