mirror of
https://github.com/django/django.git
synced 2025-08-16 16:50:33 +00:00
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
This commit is contained in:
parent
5256a805ff
commit
b31b2d4da3
3 changed files with 64 additions and 30 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue