From f2bef2b7bc6c817af0f5fa77e1052a1f5ce12f71 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Thu, 18 Feb 2021 14:01:48 +0100 Subject: Fixed #32455 -- Allowed right combining Q() with boolean expressions. --- django/db/models/query_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db') diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index c957ffa564..ae0f886107 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -40,7 +40,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`. -- cgit v1.3