mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-25 17:46:30 +00:00
Compare commits
2 Commits
62ab0a4c47
...
99f4aed360
Author | SHA1 | Date | |
---|---|---|---|
|
99f4aed360 | ||
|
bd2cead945 |
@ -16,7 +16,7 @@ from django.http import FileResponse, Http404
|
|||||||
from django.shortcuts import redirect, resolve_url
|
from django.shortcuts import redirect, resolve_url
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone, translation
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.http import urlsafe_base64_decode
|
from django.utils.http import urlsafe_base64_decode
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
@ -390,6 +390,8 @@ class AuthorizationTemplateView(TemplateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
translation.activate("fr")
|
||||||
|
|
||||||
if "registration_id" in self.request.GET:
|
if "registration_id" in self.request.GET:
|
||||||
registration = Registration.objects.get(pk=self.request.GET.get("registration_id"))
|
registration = Registration.objects.get(pk=self.request.GET.get("registration_id"))
|
||||||
# Don't get unwanted information
|
# Don't get unwanted information
|
||||||
@ -400,6 +402,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…
x
Reference in New Issue
Block a user