diff options
| author | Jonathan Richards <jonathan@golorry.com> | 2021-03-14 14:00:40 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-17 21:53:39 +0100 |
| commit | 00b0786de533dbb3f6208d8d5eaddbf765b4e5b8 (patch) | |
| tree | 10ad86b76142e46e3a82460b4c31aacefb9af383 /django | |
| parent | 54f60bc85df7fe38ba6ef6779996d8544d340d3e (diff) | |
Fixed #32548 -- Fixed crash when combining Q() objects with boolean expressions.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query_utils.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index ae0f886107..43c93ce455 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -84,14 +84,10 @@ class Q(tree.Node): path = '%s.%s' % (self.__class__.__module__, self.__class__.__name__) if path.startswith('django.db.models.query_utils'): path = path.replace('django.db.models.query_utils', 'django.db.models') - args, kwargs = (), {} - if len(self.children) == 1 and not isinstance(self.children[0], Q): - child = self.children[0] - kwargs = {child[0]: child[1]} - else: - args = tuple(self.children) - if self.connector != self.default: - kwargs = {'_connector': self.connector} + args = tuple(self.children) + kwargs = {} + if self.connector != self.default: + kwargs['_connector'] = self.connector if self.negated: kwargs['_negated'] = True return path, args, kwargs |
