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:
@ -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'
|
||||
|
Reference in New Issue
Block a user