diff --git a/aleksis/core/migrations/0069_alter_freebusy_options_and_more.py b/aleksis/core/migrations/0069_alter_freebusy_options_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..402e50acc048e140bc6f5b7a4813ad312ae27690 --- /dev/null +++ b/aleksis/core/migrations/0069_alter_freebusy_options_and_more.py @@ -0,0 +1,26 @@ +# Generated by Django 5.1.3 on 2024-11-30 15:23 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("core", "0068_calendar_event_amends_unique_constraints"), + ] + + operations = [ + migrations.AddField( + model_name="schoolterm", + name="parent", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="core.schoolterm", + verbose_name="Parent", + ), + ), + ] diff --git a/aleksis/core/models.py b/aleksis/core/models.py index 02a60685a11ee349fd9341a2ba3b48adc05e7e9b..e360a44f695122adf194f58bfba8dd440566cc8c 100644 --- a/aleksis/core/models.py +++ b/aleksis/core/models.py @@ -117,6 +117,10 @@ class SchoolTerm(ExtensibleModel): date_start = models.DateField(verbose_name=_("Start date")) date_end = models.DateField(verbose_name=_("End date")) + parent = models.ForeignKey( + "SchoolTerm", models.SET_NULL, null=True, blank=True, verbose_name=_("Parent") + ) + @classmethod @cache_memoize(3600) def get_current(cls, day: Optional[date] = None):