Files
app-store-optimization/skills/loki-mode/benchmarks/results/2026-01-05-01-24-17/swebench-patches/django__django-13028.patch

13 lines
957 B
Diff

This appears to be a Django issue that needs to be applied to the Django repository. Based on the issue description and the provided hint, I can generate the patch directly. The fix is clear from the hint - we need to check if the expression has `resolve_expression` attribute before checking the `filterable` attribute, to avoid false positives when a model happens to have a field named `filterable`.
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1124,7 +1124,7 @@ class Query(BaseExpression):
def check_filterable(self, expression):
"""Raise an error if expression cannot be used in a WHERE clause."""
- if not getattr(expression, 'filterable', True):
+ if hasattr(expression, 'resolve_expression') and not getattr(expression, 'filterable', True):
raise NotSupportedError(
expression.__class__.__name__ + ' is disallowed in the filter '
'clause.'