Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
45b26d08
Commit
45b26d08
authored
Jan 26, 2018
by
Asad Azam
Committed by
AsadAzam
Feb 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ordered subjects in course metadata courses
parent
925bc682
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
3 deletions
+43
-3
course_discovery/apps/course_metadata/migrations/0077_auto_20180126_1204.py
+22
-0
course_discovery/apps/course_metadata/migrations/0078_merge_20180209_1044.py
+16
-0
course_discovery/apps/course_metadata/models.py
+1
-1
course_discovery/apps/publisher/api/v1/views.py
+4
-2
No files found.
course_discovery/apps/course_metadata/migrations/0077_auto_20180126_1204.py
0 → 100644
View file @
45b26d08
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-01-26 12:04
from
__future__
import
unicode_literals
import
sortedm2m.fields
from
django.db
import
migrations
from
sortedm2m.operations
import
AlterSortedManyToManyField
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'course_metadata'
,
'0076_auto_20171219_1841'
),
]
operations
=
[
AlterSortedManyToManyField
(
model_name
=
'course'
,
name
=
'subjects'
,
field
=
sortedm2m
.
fields
.
SortedManyToManyField
(
blank
=
True
,
help_text
=
None
,
to
=
'course_metadata.Subject'
),
),
]
course_discovery/apps/course_metadata/migrations/0078_merge_20180209_1044.py
0 → 100644
View file @
45b26d08
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-02-09 10:44
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'course_metadata'
,
'0077_auto_20180131_1956'
),
(
'course_metadata'
,
'0077_auto_20180126_1204'
),
]
operations
=
[
]
course_discovery/apps/course_metadata/models.py
View file @
45b26d08
...
...
@@ -340,7 +340,7 @@ class Course(TimeStampedModel):
full_description
=
models
.
TextField
(
default
=
None
,
null
=
True
,
blank
=
True
)
authoring_organizations
=
SortedManyToManyField
(
Organization
,
blank
=
True
,
related_name
=
'authored_courses'
)
sponsoring_organizations
=
SortedManyToManyField
(
Organization
,
blank
=
True
,
related_name
=
'sponsored_courses'
)
subjects
=
models
.
ManyToManyField
(
Subject
,
blank
=
True
)
subjects
=
Sorted
ManyToManyField
(
Subject
,
blank
=
True
)
prerequisites
=
models
.
ManyToManyField
(
Prerequisite
,
blank
=
True
)
level_type
=
models
.
ForeignKey
(
LevelType
,
default
=
None
,
null
=
True
,
blank
=
True
)
expected_learning_items
=
SortedManyToManyField
(
ExpectedLearningItem
,
blank
=
True
)
...
...
course_discovery/apps/publisher/api/v1/views.py
View file @
45b26d08
import
logging
from
collections
import
OrderedDict
from
edx_rest_api_client.client
import
EdxRestApiClient
from
edx_rest_framework_extensions.authentication
import
JwtAuthentication
from
rest_framework
import
permissions
,
serializers
,
status
,
viewsets
...
...
@@ -112,11 +113,12 @@ class CourseRunViewSet(viewsets.GenericViewSet):
discovery_course
.
image
.
save
(
publisher_course
.
image
.
name
,
publisher_course
.
image
.
file
)
discovery_course
.
authoring_organizations
.
add
(
*
publisher_course
.
organizations
.
all
())
subjects
=
[
subject
for
subject
in
set
(
[
subjects
=
[
subject
for
subject
in
[
publisher_course
.
primary_subject
,
publisher_course
.
secondary_subject
,
publisher_course
.
tertiary_subject
])
if
subject
]
]
if
subject
]
subjects
=
list
(
OrderedDict
.
fromkeys
(
subjects
))
discovery_course
.
subjects
.
add
(
*
subjects
)
defaults
=
{
...
...
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