From 200848816d7122fd2fc69c8e12522f90772eef2a Mon Sep 17 00:00:00 2001 From: ynerant Date: Sun, 7 Feb 2021 17:31:50 +0100 Subject: [PATCH] Admins can (in)validate participations --- apps/participation/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/participation/views.py b/apps/participation/views.py index dcb0ae1..469081c 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -234,8 +234,9 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView) """ An admin validates the team (or not) """ - if not self.object.participation.tournament \ - or self.request.user.registration not in self.object.participation.tournament.organizers.all(): + if not self.request.user.user.registration.is_admin and \ + (not self.object.participation.tournament + or self.request.user.registration not in self.object.participation.tournament.organizers.all()): form.add_error(None, _("You are not an organizer of the tournament.")) return self.form_invalid(form) elif self.object.participation.valid is not False: