1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-26 06:22:22 +00:00

Raise error when a given tournament does not exist

This commit is contained in:
Yohann D'ANELLO 2021-01-29 15:05:25 +01:00
parent 2367131316
commit f4e0d0a95e
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

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