-
Notifications
You must be signed in to change notification settings - Fork 3
Unit and detail page copy updates #1235
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
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5e4bfdd
fixing capitalization on channel detail panel
shanbady feb2baf
fixing link target
shanbady 27fdd29
capitalizing academic
shanbady 7f8bb7d
copy updates
shanbady 974b9ad
adding data migration for copy updates
shanbady 1fe9a90
adding guard condition
shanbady dd28b7b
changing rel type on external link
shanbady 99e54f1
Update frontends/mit-open/src/pages/UnitsListingPage/UnitsListingPage…
shanbady febfeb1
Update frontends/mit-open/src/pages/UnitsListingPage/UnitsListingPage…
shanbady 56bac72
fixing fixture
shanbady e152159
Update frontends/mit-open/src/page-components/ChannelDetails/ChannelD…
shanbady d723cbe
disabling lint check
shanbady 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
131 changes: 131 additions & 0 deletions
131
data_fixtures/migrations/0002_unit_page_copy_updates.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,131 @@ | ||
| # Generated by Django 4.2.13 on 2024-07-08 17:08 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| fixtures = [ | ||
| { | ||
| "name": "ocw", | ||
| "offeror_configuration": { | ||
| "audience": ["Students", "Professionals", "Educators", "Lifelong Learners"], | ||
| "value_prop": ( | ||
| "For millions of learners and educators around the " | ||
| "world, OpenCourseWare shares free open educational resources from " | ||
| "across the entire MIT curriculum. With no " | ||
| "sign-up needed, thousands of downloadable materials, " | ||
| "and convenient online access, you're " | ||
| "empowered for self-paced learning and adapting these materials in " | ||
| "the ways that suit you best." | ||
| ), | ||
| }, | ||
| "channel_configuration": { | ||
| "sub_heading": ( | ||
| "For millions of learners and educators around " | ||
| "the world, OpenCourseWare shares free open educational resources" | ||
| " from across the entire MIT curriculum. With no sign-up needed, " | ||
| "thousands of downloadable materials, and convenient online access, " | ||
| "you're empowered for self-paced learning and adapting these " | ||
| "materials in the ways that suit you best." | ||
| ), | ||
| }, | ||
| }, | ||
| { | ||
| "name": "mitx", | ||
| "channel_configuration": {}, | ||
| "offeror_configuration": { | ||
| "audience": ["Lifelong Learners", "Students", "Professionals"], | ||
| "certifications": ["Certificate of Completion", "MicroMasters Credential"], | ||
| }, | ||
| }, | ||
| { | ||
| "name": "mitpe", | ||
| "offeror_configuration": { | ||
| "audience": [ | ||
| "Engineering Professionals", | ||
| "Technical Professionals", | ||
| "Scientists and Researchers", | ||
| "Senior Executives", | ||
| ], | ||
| "formats": ["Online", "In-Person", "Hybrid"], | ||
| "certifications": ["Certificate of Completion", "Professional Certificate"], | ||
| "content_types": ["Professional"], | ||
| "value_prop": ( | ||
| "MIT Professional Education is a leader in " | ||
| "technology and engineering education" | ||
| " for working professionals pursuing career advancement, and " | ||
| "for organizations seeking to meet modern-day challenges " | ||
| "by expanding the knowledge and skills of their employees. " | ||
| "Courses are delivered in a range of formats—in-person " | ||
| "(on-campus and live virtual), online, and through hybrid " | ||
| "approaches—to meet the needs of today's learners." | ||
| ), | ||
| }, | ||
| "channel_configuration": { | ||
| "heading": ( | ||
| "Join a powerful network of innovators and master " | ||
| "skills the global market needs in years to come." | ||
| ), | ||
| "sub_heading": ( | ||
| "MIT Professional Education is a leader in technology and engineering " | ||
| "education for working professionals pursuing career " | ||
| "advancement, and for organizations seeking to meet modern-day " | ||
| "challenges by expanding the knowledge and skills of their employees. " | ||
| "Courses are delivered in a range of formats—in-person (on-campus and" | ||
| " live virtual), online, and through hybrid approaches—to " | ||
| "meet the needs of today's learners." | ||
| ), | ||
| }, | ||
| }, | ||
| { | ||
| "name": "see", | ||
| "offeror_configuration": { | ||
| "audience": [ | ||
| "Business Professionals", | ||
| "Senior Executives", | ||
| "Entrepreneurs", | ||
| "Intrapreneurs", | ||
| ], | ||
| "formats": ["Online", "In-Person", "Hybrid"], | ||
| "fee": ["Paid"], | ||
| "certifications": ["Certificate of Completion", "Professional Certificate"], | ||
| }, | ||
| "channel_configuration": {}, | ||
| }, | ||
| { | ||
| "name": "xpro", | ||
| "offeror_configuration": { | ||
| "formats": ["Online", "In Person", "Hybrid"], | ||
| "certifications": ["Professional Certificate"], | ||
| }, | ||
| "channel_configuration": {}, | ||
| }, | ||
| ] | ||
|
|
||
|
|
||
| def update_copy(apps, schema_editor): | ||
| Channel = apps.get_model("channels", "Channel") | ||
| LearningResourceOfferor = apps.get_model( | ||
| "learning_resources", "LearningResourceOfferor" | ||
| ) | ||
| for fixture in fixtures: | ||
| channel_configuration_updates = fixture["channel_configuration"] | ||
| offeror_configuration_updates = fixture["offeror_configuration"] | ||
| channel = Channel.objects.get(name=fixture["name"]) | ||
| if Channel.objects.filter(name=fixture["name"]).exists(): | ||
| for key, val in channel_configuration_updates.items(): | ||
| channel.configuration[key] = val | ||
| channel.save() | ||
| if LearningResourceOfferor.objects.filter(code=fixture["name"]).exists(): | ||
| offeror = LearningResourceOfferor.objects.get(code=fixture["name"]) | ||
| for key, val in offeror_configuration_updates.items(): | ||
| setattr(offeror, key, val) | ||
| offeror.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("data_fixtures", "0001_add_testimonial_data"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RunPython(update_copy, migrations.RunPython.noop), | ||
| ] |
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.
Uh oh!
There was an error while loading. Please reload this page.