-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add courseware language support
- Loading branch information
1 parent
6482515
commit 91c897f
Showing
17 changed files
with
315 additions
and
12 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Generated by Django 4.2.17 on 2025-01-03 08:36 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
def populate_course_language(apps, schema_editor): | ||
"""Prepopulate the course language for the course pages""" | ||
|
||
CoursePage = apps.get_model("cms.CoursePage") | ||
ExternalCoursePage = apps.get_model("cms.ExternalCoursePage") | ||
ProgramPage = apps.get_model("cms.ProgramPage") | ||
ExternalProgramPage = apps.get_model("cms.ExternalProgramPage") | ||
|
||
CourseLanguage = apps.get_model("courses.CourseLanguage") | ||
course_language_english = CourseLanguage.objects.get(name="English") | ||
|
||
CoursePage.objects.update(language=course_language_english) | ||
ExternalCoursePage.objects.update(language=course_language_english) | ||
ProgramPage.objects.update(language=course_language_english) | ||
ExternalProgramPage.objects.update(language=course_language_english) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("courses", "0042_add_course_language"), | ||
("cms", "0077_alter_certificatepage_ceus"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="coursepage", | ||
name="language", | ||
field=models.ForeignKey( | ||
blank=True, | ||
help_text="The course/program language for this page", | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="externalcoursepage", | ||
name="language", | ||
field=models.ForeignKey( | ||
blank=True, | ||
help_text="The course/program language for this page", | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="externalprogrampage", | ||
name="language", | ||
field=models.ForeignKey( | ||
blank=True, | ||
help_text="The course/program language for this page", | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="programpage", | ||
name="language", | ||
field=models.ForeignKey( | ||
blank=True, | ||
help_text="The course/program language for this page", | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.RunPython( | ||
populate_course_language, reverse_code=migrations.RunPython.noop | ||
), | ||
] |
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,53 @@ | ||
# Generated by Django 4.2.17 on 2025-01-03 08:39 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("cms", "0078_add_courseware_page_language"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="coursepage", | ||
name="language", | ||
field=models.ForeignKey( | ||
help_text="The course/program language for this page", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="externalcoursepage", | ||
name="language", | ||
field=models.ForeignKey( | ||
help_text="The course/program language for this page", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="externalprogrampage", | ||
name="language", | ||
field=models.ForeignKey( | ||
default="", | ||
help_text="The course/program language for this page", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name="programpage", | ||
name="language", | ||
field=models.ForeignKey( | ||
default="", | ||
help_text="The course/program language for this page", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="courses.courselanguage", | ||
), | ||
preserve_default=False, | ||
), | ||
] |
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
Oops, something went wrong.