summaryrefslogtreecommitdiff
path: root/django/db/models/query.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-06-06 13:35:33 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-06-06 13:35:33 +0000
commit151d88af4e972547c40f1e70a3cd982f202f5c86 (patch)
treedb0a29fc314bcb765e587e8f482f3d9c16ba327a /django/db/models/query.py
parentfa43a32bcbfd7b2e7092c664251406416ef280fd (diff)
downloaddjango-151d88af4e972547c40f1e70a3cd982f202f5c86.tar.gz
Fixed #11082 -- Ensured that subqueries used in an exclude(X__in=) clause aren't pre-evaluated. Thanks to Henry Andrews for the report, and clement for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10929 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/query.py')
-rw-r--r--django/db/models/query.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 0f34fb8a5a..46a86fc03c 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -7,6 +7,8 @@ try:
except NameError:
from sets import Set as set # Python 2.3 fallback
+from copy import deepcopy
+
from django.db import connection, transaction, IntegrityError
from django.db.models.aggregates import Aggregate
from django.db.models.fields import DateField
@@ -40,6 +42,17 @@ class QuerySet(object):
# PYTHON MAGIC METHODS #
########################
+ def __deepcopy__(self, memo):
+ """
+ Deep copy of a QuerySet doesn't populate the cache
+ """
+ obj_dict = deepcopy(self.__dict__, memo)
+ obj_dict['_iter'] = None
+
+ obj = self.__class__()
+ obj.__dict__.update(obj_dict)
+ return obj
+
def __getstate__(self):
"""
Allows the QuerySet to be pickled.