Ticket #12086: 12086.returning_qs_delete.diff
File 12086.returning_qs_delete.diff, 1006 bytes (added by , 15 years ago) |
---|
-
django/db/models/query.py
380 380 # Delete objects in chunks to prevent the list of related objects from 381 381 # becoming too long. 382 382 seen_objs = None 383 count = 0 383 384 while 1: 384 385 # Collect all the objects to be deleted in this chunk, and all the 385 386 # objects that are related to the objects that are to be deleted. 386 387 seen_objs = CollectedObjects(seen_objs) 387 388 for object in del_query[:CHUNK_SIZE]: 388 389 object._collect_sub_objects(seen_objs) 390 count += 1 389 391 390 392 if not seen_objs: 391 393 break … … 393 395 394 396 # Clear the result cache, in case this QuerySet gets reused. 395 397 self._result_cache = None 398 return count 396 399 delete.alters_data = True 397 400 398 401 def update(self, **kwargs):