mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-29 18:31:10 +02:00
First interface to start draws
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -2,8 +2,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.db.models import Q
|
||||
from django.views.generic import TemplateView
|
||||
from django.views.generic import TemplateView, DetailView
|
||||
|
||||
from participation.models import Tournament
|
||||
|
||||
@ -16,12 +15,18 @@ class DisplayView(LoginRequiredMixin, TemplateView):
|
||||
|
||||
reg = self.request.user.registration
|
||||
if reg.is_admin:
|
||||
tournaments = Tournament.objects.all()
|
||||
tournaments = Tournament.objects.order_by('id').all()
|
||||
elif reg.is_volunteer:
|
||||
tournaments = reg.interesting_tournaments
|
||||
tournaments = reg.interesting_tournaments.order_by('id').all()
|
||||
else:
|
||||
tournaments = [reg.team.participation.tournament]
|
||||
context['tournaments'] = [{'id': t.id, 'name': t.name} for t in tournaments]
|
||||
context['tournaments'] = tournaments
|
||||
context['tournaments_simplified'] = [{'id': t.id, 'name': t.name} for t in tournaments]
|
||||
|
||||
|
||||
return context
|
||||
|
||||
|
||||
class DisplayContentView(LoginRequiredMixin, DetailView):
|
||||
model = Tournament
|
||||
template_name = 'draw/tournament_content.html'
|
||||
|
Reference in New Issue
Block a user