diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index d44eac186e..0893a4dd12 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -111,10 +111,10 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): chapter = module_store.get_item(Location(['i4x', 'edX', 'full', 'chapter','Week_1', None])) # make sure the parent no longer points to the child object which was deleted - self.assertTrue(sequential.location.url() in chapter.definition['children']) + self.assertTrue(sequential.location.url() in chapter.children) self.client.post(reverse('delete_item'), - json.dumps({'id': sequential.location.url(), 'delete_children':'true'}), + json.dumps({'id': sequential.location.url(), 'delete_children': 'true'}), "application/json") found = False @@ -129,7 +129,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): chapter = module_store.get_item(Location(['i4x', 'edX', 'full', 'chapter','Week_1', None])) # make sure the parent no longer points to the child object which was deleted - self.assertFalse(sequential.location.url() in chapter.definition['children']) + self.assertFalse(sequential.location.url() in chapter.children) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 0a87306666..4ae59f5656 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -649,9 +649,11 @@ def delete_item(request): for parent_loc in parent_locs: parent = modulestore('direct').get_item(parent_loc) item_url = item_loc.url() - if item_url in parent.definition["children"]: - parent.definition["children"].remove(item_url) - modulestore('direct').update_children(parent.location, parent.definition["children"]) + if item_url in parent.children: + children = parent.children + children.remove(item_url) + parent.children = children + modulestore('direct').update_children(parent.location, parent.children) return HttpResponse()