Merge branch 'dev' into 'master'

Raise error when a given tournament does not exist

See merge request animath/si/plateforme-tfjm!16
This commit is contained in:
Yohann D'ANELLO 2021-01-29 19:24:43 +00:00
commit a8a69c766c
1 changed files with 1 additions and 1 deletions

View File

@ -377,7 +377,7 @@ class AuthorizationTemplateView(TemplateView):
or self.request.user.is_authenticated and self.request.user.registration.is_admin:
context["registration"] = registration
if "tournament_id" in self.request.GET and self.request.GET.get("tournament_id").isnumeric():
if not Tournament.objects.filter(pk=self.request.get("tournament_id")).exists():
if not Tournament.objects.filter(pk=self.request.GET.get("tournament_id")).exists():
raise PermissionDenied("Ce tournoi n'existe pas.")
context["tournament"] = Tournament.objects.get(pk=self.request.GET.get("tournament_id"))
else: