diff --git a/biscuit/apps/chronos/models.py b/biscuit/apps/chronos/models.py index b6ec3a0885fac9e925ebff265ac4af5775bbbb5f..9a5d529038dac514076f0334f07e7dce626e1e1a 100644 --- a/biscuit/apps/chronos/models.py +++ b/biscuit/apps/chronos/models.py @@ -133,7 +133,7 @@ class LessonSubstitution(SchoolRelated): 'lesson_period__period__weekday', 'lesson_period__period__period'] constraints = [ models.CheckConstraint( - check=Q(cancelled=False, subject__isnull=False) | Q(cancelled=True, subject__isnull=True, room__isnull=True), + check=~Q(cancelled=True, subject__isnull=False), name='either_substituted_or_cancelled' ) ]