From 0dd3c577fcde495a7ecf4c6c10b2ba3662d42ab3 Mon Sep 17 00:00:00 2001 From: Ali Akbar <52413434+Ali-D-Akbar@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:58:56 +0500 Subject: [PATCH] chore: update microbachelors seat types (#4132) --- .../0336_update_microbachelors_seat_types.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 course_discovery/apps/course_metadata/migrations/0336_update_microbachelors_seat_types.py diff --git a/course_discovery/apps/course_metadata/migrations/0336_update_microbachelors_seat_types.py b/course_discovery/apps/course_metadata/migrations/0336_update_microbachelors_seat_types.py new file mode 100644 index 0000000000..342d3bf19b --- /dev/null +++ b/course_discovery/apps/course_metadata/migrations/0336_update_microbachelors_seat_types.py @@ -0,0 +1,26 @@ +""" +Migration to remove audit seat type from micro_bachelors program type. +""" +from django.db import migrations + + +def update_program_type(apps, schema_editor): # pylint: disable=unused-argument + ProgramType = apps.get_model('course_metadata', 'ProgramType') + SeatType = apps.get_model('course_metadata', 'SeatType') + + micro_bachelors = ProgramType.objects.get(slug='microbachelors') + verified_seat_type = SeatType.objects.get(slug='verified') + + # Set the applicable seat types for 'MicroBachelors' to only 'verified' + micro_bachelors.applicable_seat_types.set([verified_seat_type]) + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_metadata', '0335_migrateprogramslugconfiguration'), + ] + + operations = [ + migrations.RunPython(update_program_type, migrations.RunPython.noop), + ]