diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 8911150fbb..7d27db51e2 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -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() diff --git a/common/lib/xmodule/xmodule/modulestore/draft.py b/common/lib/xmodule/xmodule/modulestore/draft.py index 33ee9eaab2..5fbf05ed9b 100644 --- a/common/lib/xmodule/xmodule/modulestore/draft.py +++ b/common/lib/xmodule/xmodule/modulestore/draft.py @@ -157,11 +157,8 @@ class DraftModuleStore(ModuleStoreBase): location: Something that can be passed to Location """ + return super(DraftModuleStore, self).delete_item(as_draft(location)) - # cdodge: we should always delete both the draft and the original - super(DraftModuleStore, self).delete_item(as_draft(location)) - if (location.revision == None): # did caller request to delete the non-draft, if so be sure to do that - super(DraftModuleStore, self).delete_item(location) def get_parent_locations(self, location): '''Find all locations that are the parents of this location. Needed