1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-03 18:02:50 +02:00

Create tournaments

This commit is contained in:
Yohann D'ANELLO
2020-12-31 12:13:42 +01:00
parent 03144ae58e
commit 4e29b4830a
13 changed files with 140 additions and 97 deletions

View File

@ -23,7 +23,8 @@ from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix
from tfjm.views import AdminMixin
from .forms import JoinTeamForm, ParticipationForm, RequestValidationForm, TeamForm, ValidateParticipationForm
from .forms import JoinTeamForm, ParticipationForm, RequestValidationForm, TeamForm, ValidateParticipationForm, \
TournamentForm
from .models import Participation, Team, Tournament
from .tables import TeamTable, TournamentTable
@ -404,5 +405,37 @@ class ParticipationDetailView(LoginRequiredMixin, DetailView):
class TournamentListView(SingleTableView):
"""
Display the list of all tournaments.
"""
model = Tournament
table_class = TournamentTable
class TournamentCreateView(AdminMixin, CreateView):
"""
Create a new tournament.
"""
model = Tournament
form_class = TournamentForm
def get_success_url(self):
return reverse_lazy("participation:tournament_detail", args=(self.object.pk,))
class TournamentUpdateView(AdminMixin, UpdateView):
"""
Update tournament detail.
"""
model = Tournament
form_class = TournamentForm
def get_success_url(self):
return reverse_lazy("participation:tournament_detail", args=(self.object.pk,))
class TournamentDetailView(DetailView):
"""
Display tournament detail.
"""
model = Tournament