From bd2cead945c59beca52b57bc751fd098c93702e4 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 20 Jan 2024 17:09:06 +0100 Subject: [PATCH] Authorization templates can be fetched by tournament name Signed-off-by: Emmy D'Anello --- registration/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/registration/views.py b/registration/views.py index a7bd048..be5c24a 100644 --- a/registration/views.py +++ b/registration/views.py @@ -400,6 +400,10 @@ class AuthorizationTemplateView(TemplateView): 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")) + elif "tournament_name" in self.request.GET: + if not Tournament.objects.filter(name__iexact=self.request.GET.get("tournament_name")).exists(): + raise PermissionDenied("Ce tournoi n'existe pas.") + context["tournament"] = Tournament.objects.get(name__iexact=self.request.GET.get("tournament_name")) else: raise PermissionDenied("Merci d'indiquer un tournoi.")