mirror of
https://github.com/django/django.git
synced 2025-10-29 00:26:07 +00:00
Fixed #13309 -- Ensure that delete() deletes everything it should delete(). Thanks to craig.kimerer@gmail.com for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12941 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -429,13 +429,14 @@ class QuerySet(object):
|
||||
# Delete objects in chunks to prevent the list of related objects from
|
||||
# becoming too long.
|
||||
seen_objs = None
|
||||
del_itr = iter(del_query)
|
||||
while 1:
|
||||
# Collect a chunk of objects to be deleted, and then all the
|
||||
# objects that are related to the objects that are to be deleted.
|
||||
# The chunking *isn't* done by slicing the del_query because we
|
||||
# need to maintain the query cache on del_query (see #12328)
|
||||
seen_objs = CollectedObjects(seen_objs)
|
||||
for i, obj in izip(xrange(CHUNK_SIZE), del_query):
|
||||
for i, obj in izip(xrange(CHUNK_SIZE), del_itr):
|
||||
obj._collect_sub_objects(seen_objs)
|
||||
|
||||
if not seen_objs:
|
||||
|
||||
Reference in New Issue
Block a user