diff --git a/aleksis/apps/alsijil/migrations/0020_documentation_extramark_colour_bg_and_more.py b/aleksis/apps/alsijil/migrations/0020_documentation_extramark_colour_bg_and_more.py index 6122c13448ac2ddcfc71a4d8d747cb0f3eb6f45b..602a266ad644a341f281353250ac312ac3b5a63b 100644 --- a/aleksis/apps/alsijil/migrations/0020_documentation_extramark_colour_bg_and_more.py +++ b/aleksis/apps/alsijil/migrations/0020_documentation_extramark_colour_bg_and_more.py @@ -89,8 +89,4 @@ class Migration(migrations.Migration): model_name='newpersonalnote', constraint=models.CheckConstraint(check=models.Q(models.Q(('note', ''), _negated=True), ('extra_mark__isnull', False), _connector='OR'), name='unique_absence_per_documentation'), ), - migrations.AddConstraint( - model_name='documentation', - constraint=models.CheckConstraint(check=models.Q(('amends__isnull', True), ('course__isnull', True), _negated=True), name='either_course_or_amends'), - ), ] diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py index 930bbc3d5d6bfa0dfed62ab5428c20e99c86e1a1..ccf3f1617bb8134bd55500928bb4d034d79d2968 100644 --- a/aleksis/apps/alsijil/models.py +++ b/aleksis/apps/alsijil/models.py @@ -511,12 +511,8 @@ class Documentation(CalendarEvent): class Meta: verbose_name = _("Documentation") verbose_name_plural = _("Documentations") - constraints = [ - models.CheckConstraint( - check=~Q(course__isnull=True, amends__isnull=True), - name="either_course_or_amends", - ), - ] + # should check if object has either course or amends, + # which is not possible via constraint, because amends is not local to Documentation @classmethod def get_for_coursebook(