From b0dd660be9d1ca24bad832fbf763c88fff9c989e Mon Sep 17 00:00:00 2001 From: Jonathan Weth <git@jonathanweth.de> Date: Tue, 14 Jun 2022 21:45:57 +0200 Subject: [PATCH] Make school term a required field for instructions --- aleksis/apps/alsijil/forms.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/alsijil/forms.py b/aleksis/apps/alsijil/forms.py index e325586cb..1a4dc2a72 100644 --- a/aleksis/apps/alsijil/forms.py +++ b/aleksis/apps/alsijil/forms.py @@ -387,8 +387,12 @@ class RegisterObjectActionForm(ListActionForm): class InstructionForm(forms.ModelForm): - layout = Layout("name", "icon", "pdf_file", "groups") + layout = Layout("school_term", "name", "icon", "pdf_file", "groups") class Meta: model = Instruction - fields = ["name", "icon", "pdf_file", "groups"] + fields = ["school_term", "name", "icon", "pdf_file", "groups"] + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["school_term"].required = True -- GitLab