per feedback, change back 'draft-aware' modulestore to not delete the published copy. In delete_item in views.py do the logic to determine whether we should be using a 'draft-aware' modulestore or not, based on the category type

This commit is contained in:
Chris Dodge
2012-10-12 09:25:13 -04:00
committed by Calen Pennington
parent 1015b3a974
commit 281f194b2a
2 changed files with 9 additions and 6 deletions

View File

@@ -470,10 +470,16 @@ def delete_item(request):
item = modulestore().get_item(item_location)
_direct_delete_categories = ['course', 'chapter', 'sequential']
# @TODO: this probably leaves draft items dangling.
if delete_children:
_xmodule_recurse(item, lambda i: modulestore().delete_item(i.location))
_xmodule_recurse(item, lambda i: modulestore('direct' if
i.location.category in _direct_delete_categories else 'direct').delete_item(i.location))
else:
modulestore().delete_item(item.location)
modulestore('direct' if
item.location.category in _direct_delete_categories else 'direct').delete_item(item.location)
return HttpResponse()