From 0e7be7e27c7f27b63658ae2fbdcc0ecad14acfed Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 22 Jan 2023 15:49:42 +0100 Subject: [PATCH] Students can't auto-select them for the final --- apps/participation/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/participation/views.py b/apps/participation/views.py index 378d36e..622b8f5 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -305,12 +305,16 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView): context = super().get_context_data(**kwargs) context["participation_form"] = ParticipationForm(data=self.request.POST or None, instance=self.object.participation) + if not self.request.user.registration.is_volunteer: + del context["participation_form"].fields['final'] context["title"] = _("Update team {trigram}").format(trigram=self.object.trigram) return context @transaction.atomic def form_valid(self, form): participation_form = ParticipationForm(data=self.request.POST or None, instance=self.object.participation) + if not self.request.user.registration.is_volunteer: + del participation_form.fields['final'] if not participation_form.is_valid(): return self.form_invalid(form)