diff options
| author | Hasan Ramezani <hasan.r67@gmail.com> | 2021-02-18 14:01:48 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-02-19 06:21:10 +0100 |
| commit | 0debc6ba5b99027dccd287f8c247b328e4fe9483 (patch) | |
| tree | 846b37a12842785aec94d5f38c88cb3db7649426 /django/db/models/query_utils.py | |
| parent | 732cf4c5b40def413a143b9449a9a9991fe0244f (diff) | |
[3.2.x] Fixed #32455 -- Allowed right combining Q() with boolean expressions.
Backport of f2bef2b7bc6c817af0f5fa77e1052a1f5ce12f71 from master
Diffstat (limited to 'django/db/models/query_utils.py')
| -rw-r--r-- | django/db/models/query_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index c2b693ab8d..3beca7ce30 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -68,7 +68,7 @@ class Q(tree.Node): super().__init__(children=[*args, *sorted(kwargs.items())], connector=_connector, negated=_negated) def _combine(self, other, conn): - if not isinstance(other, Q): + if not(isinstance(other, Q) or getattr(other, 'conditional', False) is True): raise TypeError(other) # If the other Q() is empty, ignore it and just use `self`. |
