summaryrefslogtreecommitdiff
path: root/django/db/models/query_utils.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-02-12 14:20:54 -0500
committerTim Graham <timograham@gmail.com>2018-02-12 15:23:41 -0500
commit9ba3df82402e7e23b353da20aea6894935241ef9 (patch)
treedfeac440909f4e03c433b3841daef91c1bb2ddba /django/db/models/query_utils.py
parentb95c49c954e3b75678bb258e9fb2ec30d0d960bb (diff)
Refs #29125 -- Made Q.deconstruct() omit 'query_utils' in the path and _connector='AND' since it's a default value.
Diffstat (limited to 'django/db/models/query_utils.py')
-rw-r--r--django/db/models/query_utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index e34963b65c..8c41116d69 100644
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -98,13 +98,16 @@ class Q(tree.Node):
def deconstruct(self):
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)
- kwargs = {'_connector': self.connector}
+ if self.connector != self.default:
+ kwargs = {'_connector': self.connector}
if self.negated:
kwargs['_negated'] = True
return path, args, kwargs