summaryrefslogtreecommitdiff
path: root/django/db/models/query_utils.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2010-03-27 15:16:27 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2010-03-27 15:16:27 +0000
commitb31b2d4da3772463d007c9d986c4bdd1392b09e7 (patch)
tree556f56c342904d12dc79a7f167225eb6accc7c4b /django/db/models/query_utils.py
parent5256a805ff1c31e4d5112627846291e91c5dc65d (diff)
Fixed #13227 -- Modified ForeignKeys to fully honor the db_prep/prep separation introduced by multidb. This was required to ensure that model instances aren't deepcopied as a result of being involved in a filter clause. Thanks to claudep for the report, and Alex Gaynor for the help on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12865 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/query_utils.py')
-rw-r--r--django/db/models/query_utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
index c899a846e3..f75b1555ab 100644
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -155,7 +155,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
@@ -166,7 +167,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