-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1069 from torchbox/feature/1301-multiple-program-…
…types #1301 - PROGRAMME FINDER | MRes Healthcare & Design and MRes RCA
- Loading branch information
Showing
18 changed files
with
313 additions
and
45 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
44 changes: 44 additions & 0 deletions
44
rca/programmes/migrations/0093_programmepageprogrammetype.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,44 @@ | ||
# Generated by Django 4.2.16 on 2025-01-14 14:23 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import modelcluster.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("programmes", "0092_link_block_url_label"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ProgrammePageProgrammeType", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"page", | ||
modelcluster.fields.ParentalKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="programme_types", | ||
to="programmes.programmepage", | ||
), | ||
), | ||
( | ||
"programme_type", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="programmes.programmetype", | ||
), | ||
), | ||
], | ||
), | ||
] |
26 changes: 26 additions & 0 deletions
26
rca/programmes/migrations/0094_migrate_programme_type_to_programme_types.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,26 @@ | ||
# Generated by Django 4.2.16 on 2025-01-14 14:25 | ||
|
||
from django.db import migrations | ||
|
||
def migrate_programme_type_to_programme_types(apps, schema_editor): | ||
# Get the models | ||
ProgrammePage = apps.get_model("programmes", "ProgrammePage") | ||
ProgrammePageProgrammeType = apps.get_model("programmes", "ProgrammePageProgrammeType") | ||
|
||
for page in ProgrammePage.objects.all(): | ||
if programme_type := page.programme_type: | ||
ProgrammePageProgrammeType.objects.create( | ||
page_id=page.id, | ||
programme_type=programme_type, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("programmes", "0093_programmepageprogrammetype"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(migrate_programme_type_to_programme_types, reverse_code=migrations.RunPython.noop), | ||
] |
17 changes: 17 additions & 0 deletions
17
rca/programmes/migrations/0095_remove_programme_type_field.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,17 @@ | ||
# Generated by Django 4.2.16 on 2025-01-17 08:54 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("programmes", "0094_migrate_programme_type_to_programme_types"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="programmepage", | ||
name="programme_type", | ||
), | ||
] |
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
46 changes: 46 additions & 0 deletions
46
rca/shortcourses/migrations/0039_shortcourseprogrammetype.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,46 @@ | ||
# Generated by Django 4.2.16 on 2025-01-14 14:45 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import modelcluster.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("programmes", "0094_migrate_programme_type_to_programme_types"), | ||
("shortcourses", "0038_shortcoursepage_dates"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ShortCourseProgrammeType", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"page", | ||
modelcluster.fields.ParentalKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="programme_types", | ||
to="shortcourses.shortcoursepage", | ||
), | ||
), | ||
( | ||
"programme_type", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="short_course", | ||
to="programmes.programmetype", | ||
), | ||
), | ||
], | ||
), | ||
] |
Oops, something went wrong.