mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-30 12:31:12 +02:00
Only participants in a valid team can see the draw
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -3,6 +3,8 @@
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import TemplateView
|
||||
from participation.models import Tournament
|
||||
|
||||
@ -25,8 +27,11 @@ class DisplayView(LoginRequiredMixin, TemplateView):
|
||||
# A volunteer can see their tournaments
|
||||
tournaments = reg.interesting_tournaments
|
||||
else:
|
||||
if not reg.team:
|
||||
raise PermissionDenied(_("You are not in a team."))
|
||||
|
||||
# A participant can see its own tournament, or the final if necessary
|
||||
tournaments = [reg.team.participation.tournament]
|
||||
tournaments = [reg.team.participation.tournament] if reg.team.participation.valid else []
|
||||
if reg.team.participation.final:
|
||||
tournaments.append(Tournament.final_tournament())
|
||||
|
||||
|
Reference in New Issue
Block a user