1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 21:58:25 +02:00
This commit is contained in:
Yohann D'ANELLO
2020-05-04 22:27:45 +02:00
parent ac2790d327
commit 9499e10524
5 changed files with 39 additions and 9 deletions

View File

@ -135,10 +135,11 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
class TeamUpdateView(LoginRequiredMixin, UpdateView):
model = Team
form_class = TeamForm
extra_context = dict(title=_("Udpate team"),)
extra_context = dict(title=_("Update team"),)
def dispatch(self, request, *args, **kwargs):
if not request.user.admin and self.request.user not in self.get_object().tournament.organizers:
if not request.user.admin and self.request.user not in self.get_object().tournament.organizers.all() \
and self.get_object() != self.request.user.team:
raise PermissionDenied
return super().dispatch(request, *args, **kwargs)