mirror of
https://github.com/django/django.git
synced 2025-08-08 04:48:27 +00:00
Fixed #32548 -- Fixed crash when combining Q() objects with boolean expressions.
This commit is contained in:
parent
54f60bc85d
commit
00b0786de5
3 changed files with 22 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue