Changeset 7092
- Timestamp:
- 02/05/08 22:10:58 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/queryset-refactor/django/db/models/query.py
r7048 r7092 219 219 return dict([(obj._get_pk_val(), obj) for obj in qs.iterator()]) 220 220 221 # XXX Mostly DONE222 221 def delete(self): 223 222 """ … … 235 234 # Delete objects in chunks to prevent the list of related objects from 236 235 # becoming too long. 237 more_objects = True 238 while more_objects: 236 while 1: 239 237 # Collect all the objects to be deleted in this chunk, and all the 240 238 # objects that are related to the objects that are to be deleted. 241 239 seen_objs = SortedDict() 242 more_objects = False243 240 for object in del_query[:CHUNK_SIZE]: 244 more_objects = True245 241 object._collect_sub_objects(seen_objs) 246 242 247 # If one or more objects were found, delete them. 248 # Otherwise, stop looping. 249 # FIXME: Does "if seen_objs:.." work here? If so, we can get rid of 250 # more_objects. 251 if more_objects: 252 delete_objects(seen_objs) 243 if not seen_objs: 244 break 245 delete_objects(seen_objs) 253 246 254 247 # Clear the result cache, in case this QuerySet gets reused.
