Commits

Tobias McNulty committed 620c3b8

use ducktyping instead of isinstance

Comments (0)

Files changed (1)

django/db/models/sql/query.py

             value = True
         elif callable(value):
             value = value()
-        elif isinstance(value, ExpressionNode):
+        elif hasattr(value, 'prepare') and hasattr(value, 'evaluate')\
+             and callable(value.prepare) and callable(value.evaluate):
             # If value is a query expression, evaluate it
             value = SQLEvaluator(value, self)
             having_clause = value.contains_aggregate