Remove ability to add media to component versions after initialization#565
Merged
ormsbee merged 2 commits intoopenedx:mainfrom Apr 29, 2026
Merged
Remove ability to add media to component versions after initialization#565ormsbee merged 2 commits intoopenedx:mainfrom
ormsbee merged 2 commits intoopenedx:mainfrom
Conversation
ormsbee
commented
Apr 28, 2026
9f10a84 to
81bdecf
Compare
Contributor
Author
|
I'll have the companion platform PR up shortly... |
81bdecf to
2a21462
Compare
Media associations must now be specified at the time when new ComponentVersions are created: * create_component_version * create_component_and_version * create_next_component_version ComponentVersions are intended to be immutable, and having create_component_version_media meant that we were encouraging a pattern where people would create a component version first, and then make modifications to it after the fact. This bumps the version to 0.47.0.
2a21462 to
adbc6c4
Compare
bradenmacdonald
approved these changes
Apr 28, 2026
Contributor
bradenmacdonald
left a comment
There was a problem hiding this comment.
Nice! Just some suggestions but nothing blocking. I haven't tested this; let me know if you want me to.
| normalized_path = path.strip().replace('\\', '/').lstrip('/') | ||
| paths_to_media_ids[normalized_path] = media_id | ||
|
|
||
| ComponentVersionMedia.objects.bulk_create( |
Contributor
There was a problem hiding this comment.
Nice, using bulk_create here will improve performance for anything with multiple pieces of media. Not sure we have much of that yet though.
Contributor
Author
|
Comments addressed in cdab85d. I'm going to squash+merge this and finish the platform PR. I ended up making the path checking stricter. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This implements #561