forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add API to return list of downstream contexts for an upstream #739
Closed
rpenido
wants to merge
14
commits into
navin/fal-4006/course-libraries-page
from
rpenido/fal-4005/list-courses-using-library
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9589c43
build: Add more apps to the set of installed apps.
feanil 18fe297
build: We don't need to override this setting.
feanil b079d4c
docs: Update the Open API docs.
feanil a1d0826
feat: entity link view and api (#36190)
navinkarkera 917ee7d
feat: Upgrade Python dependency xblocks-contrib
farhan bdd2bc3
Merge pull request #36270 from openedx/farhan/upgrade-xblocks-contrib…
farhan 9f5fe30
feat!: upgrading get_proctored_exam_results api to DRF ( 32 ) (#35612)
awais786 b7a2ffa
fix: log only for allowed_enroll email (#36273)
AhtishamShahid d29ff63
fix: Render Word cloud block editor in libraries [FC-0076] (#36199)
ChrisChV 569c2d9
Revert "fix: Remove pointless Maintenance and Announcement apps (#358…
kdmccormick 6124695
refactor: Remove broken Force-Publish UI from Studio
kdmccormick 45f44c3
Merge pull request #36259 from openedx/feanil/fix_docs_build
feanil d57fd75
feat: add API to return downstream data for an upstream library content
rpenido c8bbff9
fix: return unit/container information
rpenido File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
30 changes: 30 additions & 0 deletions
30
...ngoapps/contentstore/migrations/0010_publishableentitylink_downstream_parent_usage_key.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,30 @@ | ||
# Generated by Django 4.2.18 on 2025-02-19 23:32 | ||
|
||
from django.db import migrations | ||
from opaque_keys.edx.django.models import UsageKeyField | ||
from opaque_keys.edx.keys import UsageKey | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('contentstore', '0009_learningcontextlinksstatus_publishableentitylink'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='publishableentitylink', | ||
name='downstream_parent_usage_key', | ||
field=UsageKeyField( | ||
db_index=True, | ||
# Adds a default invalid value to the field to prevent the migration from failing | ||
default=UsageKey.from_string('block-v1:edX+DemoX+Demo_Course+type@vertical+block@invalid'), | ||
max_length=255 | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name='publishableentitylink', | ||
name='downstream_parent_usage_key', | ||
field=UsageKeyField(db_index=True, max_length=255), | ||
), | ||
] |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy with my URL choice here. I was trying to have a structure like parent/{parentId}/children instead of children/{parentId}, but I`m not sure if this is clear close to the other endpoints.
Do you think there is a better way to make it consistent with the other URLs?