Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
22bc9f39
Commit
22bc9f39
authored
Oct 18, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be sure to remove the item from the parent's list of children
parent
1905f5ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
cms/djangoapps/contentstore/views.py
+15
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
22bc9f39
...
...
@@ -537,6 +537,19 @@ def delete_item(request):
store
=
_modulestore
(
item_loc
)
# when deleting containers, we need to update any parent modules that point to this deleted item
parent_locs
=
modulestore
()
.
get_parent_locations
(
item_loc
)
if
item_loc
.
category
in
DIRECT_ONLY_CATEGORIES
or
item_loc
.
category
==
'vertical'
:
for
parent_loc
in
parent_locs
:
parent
=
modulestore
(
'direct'
)
.
get_item
(
parent_loc
)
if
parent
.
definition
[
'children'
]
is
not
None
:
children
=
parent
.
definition
[
'children'
]
try
:
children
.
remove
(
item_loc
.
url
())
except
:
pass
#assuming that element was not in the parent
modulestore
(
'direct'
)
.
update_children
(
parent_loc
,
children
)
# @TODO: this probably leaves draft items dangling. My preferance would be for the semantic to be
# if item.location.revision=None, then delete both draft and published version
...
...
@@ -554,6 +567,8 @@ def delete_item(request):
if
item
.
location
.
revision
is
None
and
item
.
location
.
category
==
'vertical'
and
delete_all_versions
:
modulestore
(
'direct'
)
.
delete_item
(
item
.
location
)
return
HttpResponse
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment