mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-30 08:31:09 +02:00
First play with websockets
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -1,8 +1,27 @@
|
||||
# Copyright (C) 2023 by Animath
|
||||
# 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 participation.models import Tournament
|
||||
|
||||
class DisplayView(TemplateView):
|
||||
|
||||
class DisplayView(LoginRequiredMixin, TemplateView):
|
||||
template_name = 'draw/index.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
reg = self.request.user.registration
|
||||
if reg.is_admin:
|
||||
tournaments = Tournament.objects.all()
|
||||
elif reg.is_volunteer:
|
||||
tournaments = reg.interesting_tournaments
|
||||
else:
|
||||
tournaments = [reg.team.participation.tournament]
|
||||
context['tournaments'] = [{'id': t.id, 'name': t.name} for t in tournaments]
|
||||
|
||||
|
||||
return context
|
||||
|
Reference in New Issue
Block a user