diff options
| author | Nicolas Baccelli <nicolas.baccelli@abc-culture.fr> | 2020-06-05 21:01:39 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-06-08 08:17:23 +0200 |
| commit | b38d44229ff185ad156bcb443d6db0db7ae3eb98 (patch) | |
| tree | a8105c54951821833c8d174df08a6ac1a35e8bd2 /django/db/models/sql/query.py | |
| parent | 78ad4b4b0201003792bfdbf1a7781cbc9ee03539 (diff) | |
Fixed #31664 -- Reallowed using non-expressions having filterable attribute as rhs in queryset filters.
Regression in 4edad1ddf6203326e0be4bdb105beecb0fe454c4.
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index ce18098fd2..d65141b834 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1124,7 +1124,10 @@ 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.' |
