From 6bcb050754d10751436981ffe1843886890fb20f Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 2 Jan 2021 00:06:58 +0100 Subject: [PATCH] Display team detail --- apps/participation/models.py | 2 +- apps/participation/tables.py | 17 +++++++-- .../templates/participation/team_detail.html | 38 +++++++++++++++---- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/apps/participation/models.py b/apps/participation/models.py index 2bb65de..da8b551 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -222,7 +222,7 @@ class Tournament(models.Model): return reverse_lazy("participation:tournament_detail", args=(self.pk,)) def __str__(self): - return repr(self) + return self.name class Meta: verbose_name = _("tournament") diff --git a/apps/participation/tables.py b/apps/participation/tables.py index e3ebd0e..2ec2dba 100644 --- a/apps/participation/tables.py +++ b/apps/participation/tables.py @@ -28,17 +28,26 @@ class TeamTable(tables.Table): # noinspection PyTypeChecker class ParticipationTable(tables.Table): name = tables.LinkColumn( - 'participation:participation_detail', - args=[tables.A("id")], - verbose_name=lambda: _("name").capitalize(), + 'participation:team_detail', + args=[tables.A("team__id")], + verbose_name=_("name").capitalize, accessor="team__name", ) trigram = tables.Column( - verbose_name=lambda: _("trigram").capitalize(), + verbose_name=_("trigram").capitalize, accessor="team__trigram", ) + valid = tables.Column( + verbose_name=_("valid").capitalize, + accessor="valid", + empty_values=(), + ) + + def render_valid(self, value): + return _("Validated") if value else _("Validation pending") if value is False else _("Not validated") + class Meta: attrs = { 'class': 'table table condensed table-striped', diff --git a/apps/participation/templates/participation/team_detail.html b/apps/participation/templates/participation/team_detail.html index f7cba26..25eb3e9 100644 --- a/apps/participation/templates/participation/team_detail.html +++ b/apps/participation/templates/participation/team_detail.html @@ -40,17 +40,41 @@ {% endfor %} -
{% trans "Chosen problem:" %}
+
{% trans "Tournament:" %}
{% trans "any" as any %} -
{{ team.participation.get_problem_display|default:any }}
+
{{ team.participation.tournament|default:any }}
-
{% trans "Authorizations:" %}
+
{% trans "Photo authorizations:" %}
+
+ {% for participant in team.participants.all %} + {% if participant.photo_authorization %} + {{ participant }}{% if not forloop.last %},{% endif %} + {% else %} + {{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} + {% endif %} + {% endfor %} +
+ +
{% trans "Health sheets:" %}
+
+ {% for participant in team.participants.all %} + {% if participant.health_sheet %} + {{ participant }}{% if not forloop.last %},{% endif %} + {% else %} + {{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} + {% endif %} + {% endfor %} +
+ +
{% trans "Parental authorizations:" %}
{% for student in team.students.all %} - {% if student.photo_authorization %} - {{ student }}{% if not forloop.last %},{% endif %} - {% else %} - {{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} + {% if student.under_18 %} + {% if student.parental_authorization %} + {{ student }}{% if not forloop.last %},{% endif %} + {% else %} + {{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} + {% endif %} {% endif %} {% endfor %}