diff options
Diffstat (limited to 'django/db/models/query_utils.py')
| -rw-r--r-- | django/db/models/query_utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 5ac08c0619..f6dc533c28 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -152,7 +152,8 @@ class Q(tree.Node): def _combine(self, other, conn): if not isinstance(other, Q): raise TypeError(other) - obj = deepcopy(self) + obj = type(self)() + obj.add(self, conn) obj.add(other, conn) return obj @@ -163,7 +164,8 @@ class Q(tree.Node): return self._combine(other, self.AND) def __invert__(self): - obj = deepcopy(self) + obj = type(self)() + obj.add(self, self.AND) obj.negate() return obj |
