Skip to content
Snippets Groups Projects
Verified Commit edac6940 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Dimplify database constraint.

parent b0bc6e8b
No related branches found
No related tags found
1 merge request!13Add function to cancel lessons. Closes #25.
......@@ -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'
)
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment