From fb06344290504b2bc29214cdcbcce58718bc0811 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 24 Oct 2012 14:57:13 -0400 Subject: [PATCH] Allow for deletion of all components in a draft --- cms/djangoapps/contentstore/views.py | 6 +++--- cms/static/coffee/src/models/module.coffee | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index d699647152..eb090d3333 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -574,11 +574,11 @@ def save_item(request): store = _modulestore(Location(item_location)); - if request.POST['data']: + if request.POST['data'] is not None: data = request.POST['data'] store.update_item(item_location, data) - if request.POST['children']: + if request.POST['children'] is not None: children = request.POST['children'] store.update_children(item_location, children) @@ -587,7 +587,7 @@ def save_item(request): # NOTE, that the postback is not the complete metadata, as there's system metadata which is # not presented to the end-user for editing. So let's fetch the original and # 'apply' the submitted metadata, so we don't end up deleting system metadata - if request.POST['metadata']: + if request.POST['metadata'] is not None: posted_metadata = request.POST['metadata'] # fetch original existing_item = modulestore().get_item(item_location) diff --git a/cms/static/coffee/src/models/module.coffee b/cms/static/coffee/src/models/module.coffee index 41bd3f4b7d..d344bda17d 100644 --- a/cms/static/coffee/src/models/module.coffee +++ b/cms/static/coffee/src/models/module.coffee @@ -1,6 +1,6 @@ class CMS.Models.Module extends Backbone.Model url: '/save_item' defaults: - data: '' - children: '' - metadata: {} + data: null + children: null + metadata: null