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
830e55d3
Commit
830e55d3
authored
Sep 18, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! course_api checkpoint
parent
13673dae
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
lms/djangoapps/course_api/blocks/forms.py
+1
-1
lms/djangoapps/course_api/blocks/serializers.py
+5
-1
lms/djangoapps/course_api/blocks/views.py
+3
-9
No files found.
lms/djangoapps/course_api/blocks/forms.py
View file @
830e55d3
...
...
@@ -68,11 +68,11 @@ class BlockListGetForm(Form):
if
cleaned_data
.
get
(
additional_field
):
cleaned_data
[
'requested_fields'
]
.
add
(
additional_field
)
# validate and set user
usage_key
=
self
.
cleaned_data
.
get
(
'usage_key'
)
if
not
usage_key
:
return
# validate and set user
requested_username
=
cleaned_data
.
get
(
'user'
,
''
)
requesting_user
=
self
.
initial
[
'request'
]
.
user
...
...
lms/djangoapps/course_api/blocks/serializers.py
View file @
830e55d3
...
...
@@ -18,7 +18,7 @@ class BlockSerializer(serializers.Serializer):
return
self
.
context
[
'block_structure'
]
.
get_xblock_field
(
block_key
,
field_name
)
def
to_native
(
self
,
block_key
):
# create response data dict for basic fields
data
=
{
'id'
:
unicode
(
block_key
),
'lms_web_url'
:
reverse
(
...
...
@@ -33,6 +33,7 @@ class BlockSerializer(serializers.Serializer):
),
}
# add additional requested fields that are supported by the various transformers
for
supported_field
in
SUPPORTED_FIELDS
:
if
supported_field
.
requested_field_name
in
self
.
context
[
'requested_fields'
]:
data
[
supported_field
.
requested_field_name
]
=
self
.
_get_field
(
...
...
@@ -41,4 +42,7 @@ class BlockSerializer(serializers.Serializer):
supported_field
.
block_field_name
,
)
if
'children'
in
self
.
context
[
'requested_fields'
]:
data
[
'children'
]
=
self
.
context
[
'block_structure'
]
.
get_children
(
block_key
)
return
data
lms/djangoapps/course_api/blocks/views.py
View file @
830e55d3
...
...
@@ -12,12 +12,6 @@ from .forms import BlockListGetForm
from
.serializers
import
BlockSerializer
# TODO
# user not specified (-> staff)
# children field
# navigation to return descendants
# support hide_from_toc
@view_auth_classes
()
class
CourseBlocks
(
DeveloperErrorViewMixin
,
ListAPIView
):
"""
...
...
@@ -46,9 +40,9 @@ class CourseBlocks(DeveloperErrorViewMixin, ListAPIView):
Example: block_counts=video,problem
* fields: (list) Indicates which additional fields to return for each block.
Default is children,graded,format,student_view_multi_devic
e
The following fields are always returned: type, display_nam
e
Example: fields=graded,format,student_view_multi_device
Example: fields=graded,format,student_view_multi_device
,children
* depth (integer or all) Indicates how deep to traverse into the blocks hierarchy.
A value of all means the entire hierarchy.
...
...
@@ -73,7 +67,7 @@ class CourseBlocks(DeveloperErrorViewMixin, ListAPIView):
* display_name: (string) The display name of the block.
* children: (list) If the block has child blocks, a list of IDs of the child blocks.
Returned only if
the "children" input parameter is True
.
Returned only if
"children" is included in the "fields" parameter
.
* block_counts: (dict) For each block type specified in the block_counts parameter to the endpoint, the
aggregate number of blocks of that type for this block and all of its descendants.
...
...
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