Add ordering to course profiles
This commit is contained in:
parent
a1228f7753
commit
b0909c52d3
|
|
@ -18,17 +18,20 @@ logger = structlog.get_logger(__name__)
|
||||||
def create_course_profiles():
|
def create_course_profiles():
|
||||||
from vbv_lernwelt.learnpath.models import CourseProfile
|
from vbv_lernwelt.learnpath.models import CourseProfile
|
||||||
|
|
||||||
|
# Allbranche, Krankenzusatzversicherung, nicht Leben, Leben
|
||||||
CourseProfile.objects.get_or_create(
|
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(
|
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(
|
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(
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -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
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
@ -11,7 +11,10 @@ def migrate(apps, schema_editor):
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("learnpath", "0017_auto_20240711_1100"),
|
(
|
||||||
|
"learnpath",
|
||||||
|
"0018_alter_courseprofile_options_circle_is_base_circle_and_more",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [migrations.RunPython(migrate)]
|
operations = [migrations.RunPython(migrate)]
|
||||||
|
|
@ -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),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -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
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ def migrate(apps, schema_editor):
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("learnpath", "0019_circle_is_base_circle"),
|
("learnpath", "0019_auto_20240730_0904"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [migrations.RunPython(migrate)]
|
operations = [migrations.RunPython(migrate)]
|
||||||
|
|
@ -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"
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
@ -69,10 +69,16 @@ class Topic(CourseBasePage):
|
||||||
|
|
||||||
class CourseProfile(models.Model):
|
class CourseProfile(models.Model):
|
||||||
code = models.CharField(max_length=255)
|
code = models.CharField(max_length=255)
|
||||||
|
order = models.IntegerField(default=999)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return self.code
|
return self.code
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = [
|
||||||
|
"order",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class CourseProfileToCircle(models.Model):
|
class CourseProfileToCircle(models.Model):
|
||||||
# this connects the course profile to a circle, because a circle can be in multiple profiles
|
# this connects the course profile to a circle, because a circle can be in multiple profiles
|
||||||
|
|
|
||||||
|
|
@ -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
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("learnpath", "0020_auto_20240711_1736"),
|
(
|
||||||
|
"learnpath",
|
||||||
|
"0018_alter_courseprofile_options_circle_is_base_circle_and_more",
|
||||||
|
),
|
||||||
("shop", "0016_alter_checkoutinformation_refno2"),
|
("shop", "0016_alter_checkoutinformation_refno2"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue