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
a00c2a7c
Commit
a00c2a7c
authored
Dec 28, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Course API: Change field name from course_id to id
parent
6bbc46b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
lms/djangoapps/course_api/serializers.py
+4
-1
lms/djangoapps/course_api/tests/test_serializers.py
+4
-1
lms/djangoapps/course_api/views.py
+7
-2
No files found.
lms/djangoapps/course_api/serializers.py
View file @
a00c2a7c
...
...
@@ -42,11 +42,11 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth
"""
blocks_url
=
serializers
.
SerializerMethodField
()
course_id
=
serializers
.
CharField
(
source
=
'id'
,
read_only
=
True
)
effort
=
serializers
.
CharField
()
end
=
serializers
.
DateTimeField
()
enrollment_start
=
serializers
.
DateTimeField
()
enrollment_end
=
serializers
.
DateTimeField
()
id
=
serializers
.
CharField
()
# pylint: disable=invalid-name
media
=
_CourseApiMediaCollectionSerializer
(
source
=
'*'
)
name
=
serializers
.
CharField
(
source
=
'display_name_with_default_escaped'
)
number
=
serializers
.
CharField
(
source
=
'display_number_with_default'
)
...
...
@@ -56,6 +56,9 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth
start_display
=
serializers
.
CharField
()
start_type
=
serializers
.
CharField
()
# 'course_id' is a deprecated field, please use 'id' instead.
course_id
=
serializers
.
CharField
(
source
=
'id'
,
read_only
=
True
)
def
get_blocks_url
(
self
,
course_overview
):
"""
Get the representation for SerializerMethodField `blocks_url`
...
...
lms/djangoapps/course_api/tests/test_serializers.py
View file @
a00c2a7c
...
...
@@ -33,7 +33,7 @@ class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase):
self
.
request_factory
=
APIRequestFactory
()
self
.
expected_data
=
{
'
course_
id'
:
u'edX/toy/2012_Fall'
,
'id'
:
u'edX/toy/2012_Fall'
,
'name'
:
u'Toy Course'
,
'number'
:
u'toy'
,
'org'
:
u'edX'
,
...
...
@@ -54,6 +54,9 @@ class TestCourseSerializer(CourseApiFactoryMixin, ModuleStoreTestCase):
'enrollment_end'
:
u'2015-07-15T00:00:00Z'
,
'blocks_url'
:
u'http://testserver/api/courses/v1/blocks/?course_id=edX
%2
Ftoy
%2
F2012_Fall'
,
'effort'
:
u'6 hours'
,
# 'course_id' is a deprecated field, please use 'id' instead.
'course_id'
:
u'edX/toy/2012_Fall'
,
}
def
_get_request
(
self
,
user
=
None
):
...
...
lms/djangoapps/course_api/views.py
View file @
a00c2a7c
...
...
@@ -27,13 +27,14 @@ class CourseDetailView(DeveloperErrorViewMixin, RetrieveAPIView):
Body consists of the following fields:
* blocks_url: used to fetch the course blocks
* course_id: Course key
* blocks_url: Used to fetch the course blocks
* effort: A textual description of the weekly hours of effort expected
in the course.
* end: Date the course ends
* enrollment_end: Date enrollment ends
* enrollment_start: Date enrollment begins
* id: A unique identifier of the course; a serialized representation
of the opaque key identifying the course.
* media: An object that contains named media items. Included here:
* course_image: An image to show for the course. Represented
as an object with the following fields:
...
...
@@ -52,6 +53,10 @@ class CourseDetailView(DeveloperErrorViewMixin, RetrieveAPIView):
* `"timestamp"`: generated form `start` timestamp
* `"empty"`: the start date should not be shown
Deprecated fields:
* course_id: Course key (use 'id' instead)
**Parameters:**
username (optional):
...
...
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