Ticket #12086: 12086.returning_qs_delete.diff

File 12086.returning_qs_delete.diff, 1006 bytes (added by Johannes Dollinger, 15 years ago)
  • django/db/models/query.py

     
    380380        # Delete objects in chunks to prevent the list of related objects from
    381381        # becoming too long.
    382382        seen_objs = None
     383        count = 0
    383384        while 1:
    384385            # Collect all the objects to be deleted in this chunk, and all the
    385386            # objects that are related to the objects that are to be deleted.
    386387            seen_objs = CollectedObjects(seen_objs)
    387388            for object in del_query[:CHUNK_SIZE]:
    388389                object._collect_sub_objects(seen_objs)
     390                count += 1
    389391
    390392            if not seen_objs:
    391393                break
     
    393395
    394396        # Clear the result cache, in case this QuerySet gets reused.
    395397        self._result_cache = None
     398        return count
    396399    delete.alters_data = True
    397400
    398401    def update(self, **kwargs):
Back to Top