mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #13227 -- Ensure that the query cache is flushed when a QuerySet is deepcopied, avoiding problems when an evaluated queryset is used as a subquery. Thanks to claudep for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12970 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
b3390fede0
commit
e93f56b174
2 changed files with 24 additions and 5 deletions
|
@ -45,11 +45,12 @@ class QuerySet(object):
|
|||
"""
|
||||
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)
|
||||
for k,v in self.__dict__.items():
|
||||
if k in ('_iter','_result_cache'):
|
||||
obj.__dict__[k] = None
|
||||
else:
|
||||
obj.__dict__[k] = deepcopy(v, memo)
|
||||
return obj
|
||||
|
||||
def __getstate__(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue