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

Display pools table

This commit is contained in:
Yohann D'ANELLO
2021-01-13 16:22:26 +01:00
parent 170326d503
commit 4faec03efb
5 changed files with 48 additions and 3 deletions

View File

@ -1,11 +1,12 @@
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from django.utils import formats
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
import django_tables2 as tables
from .models import Team, Tournament
from .models import Pool, Team, Tournament
# noinspection PyTypeChecker
@ -74,3 +75,23 @@ class TournamentTable(tables.Table):
model = Tournament
fields = ('name', 'date',)
template_name = 'django_tables2/bootstrap4.html'
class PoolTable(tables.Table):
teams = tables.LinkColumn(
'participation:pool_detail',
args=[tables.A('id')],
verbose_name=_("teams"),
accessor=None,
)
def render_teams(self, record):
return ", ".join(participation.team.trigram for participation in record.participations.all())
class Meta:
attrs = {
'class': 'table table condensed table-striped',
}
model = Pool
fields = ('teams', 'round', 'tournament',)
template_name = 'django_tables2/bootstrap4.html'