Skip to content

Commit

Permalink
Fix filtering with expressions
Browse files Browse the repository at this point in the history
Closes Suor#345.
  • Loading branch information
Suor committed Jul 11, 2020
1 parent 7406322 commit d1e61f1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cacheops/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from django.db.models.sql.query import Query, ExtraWhere
from django.db.models.sql.where import NothingNode, SubqueryConstraint
from django.db.models.lookups import Lookup, Exact, In, IsNull
from django.db.models import Subquery
from django.db.models.expressions import RawSQL, Exists
from django.db.models.expressions import BaseExpression, Exists

from .conf import settings

Expand Down Expand Up @@ -41,7 +40,7 @@ def _dnf(where):
if not hasattr(where.lhs, 'target'):
return SOME_TREE
# Don't bother with complex right hand side either
if isinstance(where.rhs, (QuerySet, Query, Subquery, RawSQL)):
if isinstance(where.rhs, (QuerySet, Query, BaseExpression)):
return SOME_TREE
# Skip conditions on non-serialized fields
if isinstance(where.lhs.target, settings.CACHEOPS_SKIP_FIELDS):
Expand Down

0 comments on commit d1e61f1

Please sign in to comment.