-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into chris/FAL-4029-fix-confitional-word-cloud
- Loading branch information
Showing
8 changed files
with
191 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
cms/djangoapps/contentstore/rest_api/v2/serializers/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
"""Module for v2 serializers.""" | ||
|
||
from cms.djangoapps.contentstore.rest_api.v2.serializers.downstreams import PublishableEntityLinksSerializer | ||
from cms.djangoapps.contentstore.rest_api.v2.serializers.home import CourseHomeTabSerializerV2 |
28 changes: 28 additions & 0 deletions
28
cms/djangoapps/contentstore/rest_api/v2/serializers/downstreams.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
Serializers for upstream -> downstream entity links. | ||
""" | ||
|
||
from rest_framework import serializers | ||
|
||
from cms.djangoapps.contentstore.models import PublishableEntityLink | ||
|
||
|
||
class PublishableEntityLinksSerializer(serializers.ModelSerializer): | ||
""" | ||
Serializer for publishable entity links. | ||
""" | ||
upstream_context_title = serializers.CharField(read_only=True) | ||
upstream_version = serializers.IntegerField(read_only=True) | ||
ready_to_sync = serializers.SerializerMethodField() | ||
|
||
def get_ready_to_sync(self, obj): | ||
"""Calculate ready_to_sync field""" | ||
return bool( | ||
obj.upstream_version and | ||
obj.upstream_version > (obj.version_synced or 0) and | ||
obj.upstream_version > (obj.version_declined or 0) | ||
) | ||
|
||
class Meta: | ||
model = PublishableEntityLink | ||
exclude = ['upstream_block', 'uuid'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters