Commit 7c3d5d58 by Calen Pennington

Fix up how parent locations interact w/ draft mode when creating new units

parent 2f675be2
......@@ -571,7 +571,12 @@ def clone_item(request):
new_item.metadata['display_name'] = display_name
modulestore().update_metadata(new_item.location.url(), new_item.own_metadata)
modulestore().update_children(parent_location, parent.definition.get('children', []) + [new_item.location.url()])
if parent_location.category not in ('vertical',):
parent_update_modulestore = modulestore('direct')
else:
parent_update_modulestore = modulestore()
parent_update_modulestore.update_children(parent_location, parent.definition.get('children', []) + [new_item.location.url()])
return HttpResponse(json.dumps({'id': dest_location.url()}))
......
......@@ -100,7 +100,7 @@ class DraftModuleStore(ModuleStoreBase):
Clone a new item that is a copy of the item at the location `source`
and writes it to `location`
"""
return super(DraftModuleStore, self).clone_item(source, as_draft(location))
return wrap_draft(super(DraftModuleStore, self).clone_item(source, as_draft(location)))
def update_item(self, location, data):
"""
......@@ -159,6 +159,14 @@ class DraftModuleStore(ModuleStoreBase):
"""
return super(DraftModuleStore, self).delete_item(as_draft(location))
def get_parent_locations(self, location):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
returns an iterable of things that can be passed to Location.
'''
return super(DraftModuleStore, self).get_parent_locations(location)
def publish(self, location, published_by_id):
"""
Save a current draft to the underlying modulestore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment