1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-24 17:42:23 +00:00

Students can't auto-select them for the final

This commit is contained in:
Emmy D'Anello 2023-01-22 15:49:42 +01:00
parent b95b41a2ed
commit 0e7be7e27c

View File

@ -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)