1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-24 01:48:47 +02:00

Order participations by validity status and by trigram

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-11 22:41:52 +02:00
parent 59268f2d1e
commit 0e7a275a28
5 changed files with 35 additions and 6 deletions

View File

@ -24,7 +24,7 @@ from django.utils.crypto import get_random_string
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, DetailView, FormView, RedirectView, TemplateView, UpdateView, View
from django.views.generic.edit import FormMixin, ProcessFormView
from django_tables2 import SingleTableView
from django_tables2 import SingleTableView, MultiTableMixin
from magic import Magic
from odf.opendocument import OpenDocumentSpreadsheet
from odf.style import Style, TableCellProperties, TableColumnProperties, TextProperties
@ -555,16 +555,24 @@ class TournamentUpdateView(VolunteerMixin, UpdateView):
return super().dispatch(request, *args, **kwargs)
class TournamentDetailView(DetailView):
class TournamentDetailView(MultiTableMixin, DetailView):
"""
Display tournament detail.
"""
model = Tournament
def dispatch(self, request, *args, **kwargs):
self.tables = [
ParticipationTable(self.get_object().participations.all()),
PoolTable(self.get_object().pools.order_by('id').all()),
]
return super().dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["teams"] = ParticipationTable(self.object.participations.all())
context["pools"] = PoolTable(self.object.pools.order_by('id').all())
tables = context['tables']
context["teams"] = tables[0]
context["pools"] = tables[1]
notes = dict()
for participation in self.object.participations.all():