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

Display the tournament list

This commit is contained in:
Yohann D'ANELLO
2020-12-30 12:13:05 +01:00
parent e2e2c97584
commit 03144ae58e
6 changed files with 54 additions and 6 deletions

View File

@ -1,10 +1,10 @@
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
import django_tables2 as tables
from .models import Team
from .models import Team, Tournament
# noinspection PyTypeChecker
@ -54,3 +54,16 @@ class ParticipationTable(tables.Table):
model = Team
fields = ('name', 'trigram', 'problem',)
template_name = 'django_tables2/bootstrap4.html'
class TournamentTable(tables.Table):
def render_date(self, record):
return format_lazy(_("From {start} to {end}"), start=record.start, end=record.end)
class Meta:
attrs = {
'class': 'table table condensed table-striped',
}
model = Tournament
fields = ('name', 'date',)
template_name = 'django_tables2/bootstrap4.html'