Display team detail

This commit is contained in:
Yohann D'ANELLO 2021-01-02 00:06:58 +01:00
parent 1805f48fa0
commit 6bcb050754
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 45 additions and 12 deletions

View File

@ -222,7 +222,7 @@ class Tournament(models.Model):
return reverse_lazy("participation:tournament_detail", args=(self.pk,)) return reverse_lazy("participation:tournament_detail", args=(self.pk,))
def __str__(self): def __str__(self):
return repr(self) return self.name
class Meta: class Meta:
verbose_name = _("tournament") verbose_name = _("tournament")

View File

@ -28,17 +28,26 @@ class TeamTable(tables.Table):
# noinspection PyTypeChecker # noinspection PyTypeChecker
class ParticipationTable(tables.Table): class ParticipationTable(tables.Table):
name = tables.LinkColumn( name = tables.LinkColumn(
'participation:participation_detail', 'participation:team_detail',
args=[tables.A("id")], args=[tables.A("team__id")],
verbose_name=lambda: _("name").capitalize(), verbose_name=_("name").capitalize,
accessor="team__name", accessor="team__name",
) )
trigram = tables.Column( trigram = tables.Column(
verbose_name=lambda: _("trigram").capitalize(), verbose_name=_("trigram").capitalize,
accessor="team__trigram", 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: class Meta:
attrs = { attrs = {
'class': 'table table condensed table-striped', 'class': 'table table condensed table-striped',

View File

@ -40,17 +40,41 @@
{% endfor %} {% endfor %}
</dd> </dd>
<dt class="col-sm-6 text-right">{% trans "Chosen problem:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Tournament:" %}</dt>
{% trans "any" as any %} {% trans "any" as any %}
<dd class="col-sm-6">{{ team.participation.get_problem_display|default:any }}</dd> <dd class="col-sm-6"><a href="{% url "participation:tournament_detail" pk=team.participation.tournament.pk %}">{{ team.participation.tournament|default:any }}</a></dd>
<dt class="col-sm-6 text-right">{% trans "Authorizations:" %}</dt> <dt class="col-sm-6 text-right">{% trans "Photo authorizations:" %}</dt>
<dd class="col-sm-6">
{% for participant in team.participants.all %}
{% if participant.photo_authorization %}
<a href="{{ participant.photo_authorization.url }}" data-turbolinks="false">{{ participant }}</a>{% if not forloop.last %},{% endif %}
{% else %}
{{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %}
{% endfor %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Health sheets:" %}</dt>
<dd class="col-sm-6">
{% for participant in team.participants.all %}
{% if participant.health_sheet %}
<a href="{{ participant.health_sheet.url }}" data-turbolinks="false">{{ participant }}</a>{% if not forloop.last %},{% endif %}
{% else %}
{{ participant }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %}
{% endfor %}
</dd>
<dt class="col-sm-6 text-right">{% trans "Parental authorizations:" %}</dt>
<dd class="col-sm-6"> <dd class="col-sm-6">
{% for student in team.students.all %} {% for student in team.students.all %}
{% if student.photo_authorization %} {% if student.under_18 %}
<a href="{{ student.photo_authorization.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %} {% if student.parental_authorization %}
{% else %} <a href="{{ student.parental_authorization.url }}" data-turbolinks="false">{{ student }}</a>{% if not forloop.last %},{% endif %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %} {% else %}
{{ student }} ({% trans "Not uploaded yet" %}){% if not forloop.last %},{% endif %}
{% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</dd> </dd>