From cf08ea496e9d40f2f5b3677feedb59cd600fab91 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 13 Apr 2010 02:00:46 +0000 Subject: [1.1.X] Refs #13227 -- Partial backport of r12865; backported the changes to Where tree cloning logic to ensure that unclonable objects in a where() clause don't break querying. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12963 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'django/db') 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 -- cgit v1.3