-
Notifications
You must be signed in to change notification settings - Fork 23
feat!: ComponentVersionMedia.key -> ComponentVersionMedia.path #547
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
Merged
Merged
Changes from all commits
Commits
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 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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,9 +50,9 @@ class ComponentAdmin(ReadOnlyModelAdmin): | |
| inlines = [ComponentVersionInline] | ||
|
|
||
|
|
||
| class ContentInline(admin.TabularInline): | ||
| class MediaInline(admin.TabularInline): | ||
| """ | ||
| Django admin configuration for Content | ||
| Django admin configuration for Media | ||
|
Comment on lines
-53
to
+55
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated, just something I noticed |
||
| """ | ||
| model = ComponentVersion.media.through | ||
|
|
||
|
|
@@ -69,13 +69,13 @@ def get_queryset(self, request): | |
| ) | ||
|
|
||
| fields = [ | ||
| "key", | ||
| "path", | ||
| "format_size", | ||
| "rendered_data", | ||
| ] | ||
| readonly_fields = [ | ||
| "media", | ||
| "key", | ||
| "path", | ||
| "format_size", | ||
| "rendered_data", | ||
| ] | ||
|
|
@@ -113,7 +113,7 @@ class ComponentVersionAdmin(ReadOnlyModelAdmin): | |
| "created", | ||
| ] | ||
| list_display = ["component", "version_num", "uuid", "created"] | ||
| inlines = [ContentInline] | ||
| inlines = [MediaInline] | ||
|
|
||
| def get_queryset(self, request): | ||
| queryset = super().get_queryset(request) | ||
|
|
||
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
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
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
46 changes: 46 additions & 0 deletions
46
src/openedx_content/migrations/0012_rename_componentversionmedia_key_to_path.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| """ | ||
| Rename ComponentVersionMedia.key -> ComponentVersionMedia.path. | ||
|
|
||
| The field previously had db_column='_key'; this migration also renames the | ||
| underlying DB column to match the new field name. | ||
| """ | ||
| from django.db import migrations, models | ||
|
|
||
| import openedx_django_lib.fields | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('openedx_content', '0011_rename_entity_key_and_package_key_to_refs'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RemoveConstraint( | ||
| model_name='componentversionmedia', | ||
| name='oel_cvcontent_uniq_cv_key', | ||
| ), | ||
| migrations.RenameField( | ||
| model_name='componentversionmedia', | ||
| old_name='key', | ||
| new_name='path', | ||
| ), | ||
| # RenameField only changes the Django field name; the DB column is still | ||
| # '_key' (set via db_column). AlterField drops db_column, so Django sees | ||
| # old column='_key' vs new column='path' and renames it. | ||
| migrations.AlterField( | ||
| model_name='componentversionmedia', | ||
| name='path', | ||
| field=openedx_django_lib.fields.MultiCollationCharField( | ||
| db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, | ||
| max_length=500, | ||
| ), | ||
| ), | ||
| migrations.AddConstraint( | ||
| model_name='componentversionmedia', | ||
| constraint=models.UniqueConstraint( | ||
| fields=['component_version', 'path'], | ||
| name='oel_cvcontent_uniq_cv_key', | ||
| ), | ||
| ), | ||
| ] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,4 @@ | |
| """ | ||
|
|
||
| # The version for the entire repository | ||
| __version__ = "0.42.0" | ||
| __version__ = "0.43.0" | ||
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
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
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
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.
Oops. I feel silly for missing that one.