Authorization templates can be fetched by tournament name
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
62ab0a4c47
commit
bd2cead945
|
@ -400,6 +400,10 @@ class AuthorizationTemplateView(TemplateView):
|
||||||
if not Tournament.objects.filter(pk=self.request.GET.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"))
|
||||||
|
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:
|
else:
|
||||||
raise PermissionDenied("Merci d'indiquer un tournoi.")
|
raise PermissionDenied("Merci d'indiquer un tournoi.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue