diff --git a/server/vbv_lernwelt/learnpath/creators.py b/server/vbv_lernwelt/learnpath/creators.py index 372b17dc..360a9252 100644 --- a/server/vbv_lernwelt/learnpath/creators.py +++ b/server/vbv_lernwelt/learnpath/creators.py @@ -18,17 +18,20 @@ logger = structlog.get_logger(__name__) def create_course_profiles(): from vbv_lernwelt.learnpath.models import CourseProfile + # Allbranche, Krankenzusatzversicherung, nicht Leben, Leben CourseProfile.objects.get_or_create( - id=COURSE_PROFILE_LEBEN_ID, code=COURSE_PROFILE_LEBEN_CODE + id=COURSE_PROFILE_ALL_ID, code=COURSE_PROFILE_ALL_CODE, order=1 ) CourseProfile.objects.get_or_create( - id=COURSE_PROFILE_NICHTLEBEN_ID, code=COURSE_PROFILE_NICHTLEBEN_CODE + id=COURSE_PROFILE_KRANKENZUSATZ_ID, + code=COURSE_PROFILE_KRANKENZUSATZ_CODE, + order=2, ) CourseProfile.objects.get_or_create( - id=COURSE_PROFILE_KRANKENZUSATZ_ID, code=COURSE_PROFILE_KRANKENZUSATZ_CODE + id=COURSE_PROFILE_NICHTLEBEN_ID, code=COURSE_PROFILE_NICHTLEBEN_CODE, order=3 ) CourseProfile.objects.get_or_create( - id=COURSE_PROFILE_ALL_ID, code=COURSE_PROFILE_ALL_CODE + id=COURSE_PROFILE_LEBEN_ID, code=COURSE_PROFILE_LEBEN_CODE, order=4 ) diff --git a/server/vbv_lernwelt/learnpath/migrations/0018_alter_courseprofile_options_circle_is_base_circle_and_more.py b/server/vbv_lernwelt/learnpath/migrations/0018_alter_courseprofile_options_circle_is_base_circle_and_more.py new file mode 100644 index 00000000..f2702b68 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0018_alter_courseprofile_options_circle_is_base_circle_and_more.py @@ -0,0 +1,34 @@ +# Generated by Django 4.2.13 on 2024-07-30 07:03 + +from django.db import migrations, models +import modelcluster.fields + + +class Migration(migrations.Migration): + dependencies = [ + ("learnpath", "0017_auto_20240711_1100"), + ] + + operations = [ + migrations.AlterModelOptions( + name="courseprofile", + options={"ordering": ["order"]}, + ), + migrations.AddField( + model_name="circle", + name="is_base_circle", + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name="courseprofile", + name="order", + field=models.IntegerField(default=999), + ), + migrations.AlterField( + model_name="circle", + name="profiles", + field=modelcluster.fields.ParentalManyToManyField( + related_name="circles", to="learnpath.courseprofile" + ), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0018_auto_20240711_1527.py b/server/vbv_lernwelt/learnpath/migrations/0019_auto_20240730_0904.py similarity index 62% rename from server/vbv_lernwelt/learnpath/migrations/0018_auto_20240711_1527.py rename to server/vbv_lernwelt/learnpath/migrations/0019_auto_20240730_0904.py index d4cb42a1..46464f1e 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0018_auto_20240711_1527.py +++ b/server/vbv_lernwelt/learnpath/migrations/0019_auto_20240730_0904.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.20 on 2024-07-11 13:27 +# Generated by Django 4.2.13 on 2024-07-30 07:04 from django.db import migrations @@ -11,7 +11,10 @@ def migrate(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ("learnpath", "0017_auto_20240711_1100"), + ( + "learnpath", + "0018_alter_courseprofile_options_circle_is_base_circle_and_more", + ), ] operations = [migrations.RunPython(migrate)] diff --git a/server/vbv_lernwelt/learnpath/migrations/0019_circle_is_base_circle.py b/server/vbv_lernwelt/learnpath/migrations/0019_circle_is_base_circle.py deleted file mode 100644 index faa5981c..00000000 --- a/server/vbv_lernwelt/learnpath/migrations/0019_circle_is_base_circle.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.2.20 on 2024-07-11 15:36 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("learnpath", "0018_auto_20240711_1527"), - ] - - operations = [ - migrations.AddField( - model_name="circle", - name="is_base_circle", - field=models.BooleanField(default=False), - ), - ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0020_auto_20240711_1736.py b/server/vbv_lernwelt/learnpath/migrations/0020_auto_20240730_0905.py similarity index 74% rename from server/vbv_lernwelt/learnpath/migrations/0020_auto_20240711_1736.py rename to server/vbv_lernwelt/learnpath/migrations/0020_auto_20240730_0905.py index 2b7df592..edac10fc 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0020_auto_20240711_1736.py +++ b/server/vbv_lernwelt/learnpath/migrations/0020_auto_20240730_0905.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.20 on 2024-07-11 15:36 +# Generated by Django 4.2.13 on 2024-07-30 07:05 from django.db import migrations @@ -11,7 +11,7 @@ def migrate(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ("learnpath", "0019_circle_is_base_circle"), + ("learnpath", "0019_auto_20240730_0904"), ] operations = [migrations.RunPython(migrate)] diff --git a/server/vbv_lernwelt/learnpath/migrations/0021_alter_circle_profiles.py b/server/vbv_lernwelt/learnpath/migrations/0021_alter_circle_profiles.py deleted file mode 100644 index b4c51e5c..00000000 --- a/server/vbv_lernwelt/learnpath/migrations/0021_alter_circle_profiles.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.2.13 on 2024-07-25 14:27 - -import modelcluster.fields -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("learnpath", "0020_auto_20240711_1736"), - ] - - operations = [ - migrations.AlterField( - model_name="circle", - name="profiles", - field=modelcluster.fields.ParentalManyToManyField( - related_name="circles", to="learnpath.courseprofile" - ), - ), - ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index bc423504..a0a76f03 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -69,10 +69,16 @@ class Topic(CourseBasePage): class CourseProfile(models.Model): code = models.CharField(max_length=255) + order = models.IntegerField(default=999) def __str__(self) -> str: return self.code + class Meta: + ordering = [ + "order", + ] + class CourseProfileToCircle(models.Model): # this connects the course profile to a circle, because a circle can be in multiple profiles diff --git a/server/vbv_lernwelt/shop/migrations/0017_checkoutinformation_chosen_profile.py b/server/vbv_lernwelt/shop/migrations/0017_checkoutinformation_chosen_profile.py index 766f994e..66d74fe0 100644 --- a/server/vbv_lernwelt/shop/migrations/0017_checkoutinformation_chosen_profile.py +++ b/server/vbv_lernwelt/shop/migrations/0017_checkoutinformation_chosen_profile.py @@ -1,12 +1,15 @@ -# Generated by Django 4.2.13 on 2024-07-22 19:45 +# Generated by Django 4.2.13 on 2024-07-30 07:03 -import django.db.models.deletion from django.db import migrations, models +import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ("learnpath", "0020_auto_20240711_1736"), + ( + "learnpath", + "0018_alter_courseprofile_options_circle_is_base_circle_and_more", + ), ("shop", "0016_alter_checkoutinformation_refno2"), ]