Handle queryset implementations without lhs/rhs attribute (#204)

The `ExtraJoinRestriction` class used by django-taggit lacks the
attributes "rhs" and "lhs".
Thus projects cannot use django-taggit together with cachalot.

Closes: #121
This commit is contained in:
Lars Kruse 2021-10-26 22:34:45 +02:00 committed by GitHub
parent c8d6af575a
commit 42af2e0126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,10 +135,15 @@ def _find_subqueries_in_where(children):
elif child_class is NothingNode:
pass
else:
rhs = _find_rhs_lhs_subquery(child.rhs)
try:
child_rhs = child.rhs
child_lhs = child.lhs
except AttributeError:
raise UncachableQuery
rhs = _find_rhs_lhs_subquery(child_rhs)
if rhs is not None:
yield rhs
lhs = _find_rhs_lhs_subquery(child.lhs)
lhs = _find_rhs_lhs_subquery(child_lhs)
if lhs is not None:
yield lhs