Raise an error if expression cannot be used in a WHERE clause.
(self, expression)
| 1399 | self.check_query_object_type(v, opts, field) |
| 1400 | |
| 1401 | def check_filterable(self, expression): |
| 1402 | """Raise an error if expression cannot be used in a WHERE clause.""" |
| 1403 | if hasattr(expression, "resolve_expression") and not getattr( |
| 1404 | expression, "filterable", True |
| 1405 | ): |
| 1406 | raise NotSupportedError( |
| 1407 | expression.__class__.__name__ + " is disallowed in the filter " |
| 1408 | "clause." |
| 1409 | ) |
| 1410 | if hasattr(expression, "get_source_expressions"): |
| 1411 | for expr in expression.get_source_expressions(): |
| 1412 | self.check_filterable(expr) |
| 1413 | |
| 1414 | def build_lookup(self, lookups, lhs, rhs): |
| 1415 | """ |
no test coverage detected