Attempt to fix issue #156 by handling subquieries (#157)

* Combine child_class passing to minimize if's

Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
This commit is contained in:
John-Paul Stanford 2020-07-29 19:57:16 +01:00 committed by GitHub
parent f40a56dfe1
commit 71dcf73dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,7 +103,7 @@ def _find_subqueries_in_where(children):
yield grand_child
elif child_class is ExtraWhere:
raise IsRawQuery
elif child_class is NothingNode:
elif child_class in (NothingNode, Subquery, Exists):
pass
else:
rhs = child.rhs
@ -112,11 +112,6 @@ def _find_subqueries_in_where(children):
yield rhs
elif rhs_class is QuerySet:
yield rhs.query
elif rhs_class is Subquery or rhs_class is Exists:
try:
yield rhs.query
except:
yield rhs.queryset.query
elif rhs_class in UNCACHABLE_FUNCS:
raise UncachableQuery