Add data migration for course profiles

This commit is contained in:
Ramon Wenger 2024-07-11 15:30:07 +02:00 committed by Christian Cueni
parent 281b7c900c
commit 9713850afa
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,7 @@
COURSE_PROFILE_LEBEN_ID = -1
COURSE_PROFILE_NICHTLEBEN_ID = -2
COURSE_PROFILE_KRANKENZUSATZ_ID = -3
COURSE_PROFILE_LEBEN_CODE = "leben"
COURSE_PROFILE_NICHTLEBEN_CODE = "nichtleben"
COURSE_PROFILE_KRANKENZUSATZ_CODE = "krankenzusatzversicherung"

View File

@ -0,0 +1,22 @@
from vbv_lernwelt.learnpath.consts import (
COURSE_PROFILE_KRANKENZUSATZ_CODE,
COURSE_PROFILE_KRANKENZUSATZ_ID,
COURSE_PROFILE_LEBEN_CODE,
COURSE_PROFILE_LEBEN_ID,
COURSE_PROFILE_NICHTLEBEN_CODE,
COURSE_PROFILE_NICHTLEBEN_ID,
)
def create_course_profiles():
from vbv_lernwelt.learnpath.models import CourseProfile
CourseProfile.objects.create(
id=COURSE_PROFILE_LEBEN_ID, code=COURSE_PROFILE_LEBEN_CODE
)
CourseProfile.objects.create(
id=COURSE_PROFILE_NICHTLEBEN_ID, code=COURSE_PROFILE_NICHTLEBEN_CODE
)
CourseProfile.objects.create(
id=COURSE_PROFILE_KRANKENZUSATZ_ID, code=COURSE_PROFILE_KRANKENZUSATZ_CODE
)

View File

@ -0,0 +1,17 @@
# Generated by Django 3.2.20 on 2024-07-11 13:27
from django.db import migrations
from vbv_lernwelt.learnpath.creators import create_course_profiles
def migrate(apps, schema_editor):
create_course_profiles()
class Migration(migrations.Migration):
dependencies = [
("learnpath", "0017_auto_20240711_1100"),
]
operations = [migrations.RunPython(migrate)]