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
8f1a4cca
Commit
8f1a4cca
authored
Mar 17, 2016
by
Dmitry Viskov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Duplicate item in Studio should also duplicate related xblock aside
parent
b91f940a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletions
+17
-1
cms/djangoapps/contentstore/views/item.py
+13
-0
cms/djangoapps/contentstore/views/tests/test_item.py
+0
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
+4
-1
No files found.
cms/djangoapps/contentstore/views/item.py
View file @
8f1a4cca
...
@@ -595,6 +595,18 @@ def _duplicate_item(parent_usage_key, duplicate_source_usage_key, user, display_
...
@@ -595,6 +595,18 @@ def _duplicate_item(parent_usage_key, duplicate_source_usage_key, user, display_
else
:
else
:
duplicate_metadata
[
'display_name'
]
=
_
(
"Duplicate of '{0}'"
)
.
format
(
source_item
.
display_name
)
duplicate_metadata
[
'display_name'
]
=
_
(
"Duplicate of '{0}'"
)
.
format
(
source_item
.
display_name
)
asides_to_create
=
[]
for
aside
in
source_item
.
runtime
.
get_asides
(
source_item
):
for
field
in
aside
.
fields
.
values
():
if
field
.
scope
in
(
Scope
.
settings
,
Scope
.
content
,)
and
field
.
is_set_on
(
aside
):
asides_to_create
.
append
(
aside
)
break
for
aside
in
asides_to_create
:
for
field
in
aside
.
fields
.
values
():
if
field
.
scope
not
in
(
Scope
.
settings
,
Scope
.
content
,):
field
.
delete_from
(
aside
)
dest_module
=
store
.
create_item
(
dest_module
=
store
.
create_item
(
user
.
id
,
user
.
id
,
dest_usage_key
.
course_key
,
dest_usage_key
.
course_key
,
...
@@ -603,6 +615,7 @@ def _duplicate_item(parent_usage_key, duplicate_source_usage_key, user, display_
...
@@ -603,6 +615,7 @@ def _duplicate_item(parent_usage_key, duplicate_source_usage_key, user, display_
definition_data
=
source_item
.
get_explicitly_set_fields_by_scope
(
Scope
.
content
),
definition_data
=
source_item
.
get_explicitly_set_fields_by_scope
(
Scope
.
content
),
metadata
=
duplicate_metadata
,
metadata
=
duplicate_metadata
,
runtime
=
source_item
.
runtime
,
runtime
=
source_item
.
runtime
,
asides
=
asides_to_create
)
)
children_handled
=
False
children_handled
=
False
...
...
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
8f1a4cca
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/split_mongo/split_mongo_kvs.py
View file @
8f1a4cca
...
@@ -47,7 +47,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
...
@@ -47,7 +47,7 @@ class SplitMongoKVS(InheritanceKeyValueStore):
def
get
(
self
,
key
):
def
get
(
self
,
key
):
if
key
.
block_family
==
XBlockAside
.
entry_point
:
if
key
.
block_family
==
XBlockAside
.
entry_point
:
if
key
.
scope
not
in
[
Scope
.
settings
,
Scope
.
content
]
:
if
key
.
scope
not
in
self
.
VALID_SCOPES
:
raise
InvalidScopeError
(
key
,
self
.
VALID_SCOPES
)
raise
InvalidScopeError
(
key
,
self
.
VALID_SCOPES
)
if
key
.
block_scope_id
.
block_type
not
in
self
.
aside_fields
:
if
key
.
block_scope_id
.
block_type
not
in
self
.
aside_fields
:
...
@@ -139,6 +139,9 @@ class SplitMongoKVS(InheritanceKeyValueStore):
...
@@ -139,6 +139,9 @@ class SplitMongoKVS(InheritanceKeyValueStore):
Is the given field explicitly set in this kvs (not inherited nor default)
Is the given field explicitly set in this kvs (not inherited nor default)
"""
"""
# handle any special cases
# handle any special cases
if
key
.
scope
not
in
self
.
VALID_SCOPES
:
return
False
if
key
.
scope
==
Scope
.
content
:
if
key
.
scope
==
Scope
.
content
:
self
.
_load_definition
()
self
.
_load_definition
()
elif
key
.
scope
==
Scope
.
parent
:
elif
key
.
scope
==
Scope
.
parent
:
...
...
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