diff --git a/apps/participation/tables.py b/apps/participation/tables.py
index b3d1da1..7dea78d 100644
--- a/apps/participation/tables.py
+++ b/apps/participation/tables.py
@@ -6,7 +6,7 @@ from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _
import django_tables2 as tables
-from .models import Note, Pool, Team, Tournament
+from .models import Note, Passage, Pool, Team, Tournament
# noinspection PyTypeChecker
@@ -98,6 +98,31 @@ class PoolTable(tables.Table):
template_name = 'django_tables2/bootstrap4.html'
+class PassageTable(tables.Table):
+ defender = tables.LinkColumn(
+ "participation:passage_detail",
+ args=[tables.A("id")],
+ verbose_name=_("defender").capitalize,
+ )
+
+ def render_defender(self, value):
+ return value.team
+
+ def render_opponent(self, value):
+ return value.team
+
+ def render_reporter(self, value):
+ return value.team
+
+ class Meta:
+ attrs = {
+ 'class': 'table table-condensed table-striped text-center',
+ }
+ model = Passage
+ fields = ('defender', 'opponent', 'reporter', 'place',)
+ template_name = 'django_tables2/bootstrap4.html'
+
+
class NoteTable(tables.Table):
jury = tables.Column(
attrs={
diff --git a/apps/participation/templates/participation/pool_detail.html b/apps/participation/templates/participation/pool_detail.html
index f2ad59a..d790fef 100644
--- a/apps/participation/templates/participation/pool_detail.html
+++ b/apps/participation/templates/participation/pool_detail.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
-{% load i18n %}
+{% load django_tables2 i18n %}
{% block content %}
@@ -25,12 +25,6 @@
{% trans "Juries:" %}
{{ pool.juries.all|join:", " }}
-
{% trans "Passages:" %}
-
- {% for passage in pool.passages.all %}
- {{ passage }}{% if not forloop.last %}, {% endif %}
- {% endfor %}
-
{% trans "Defended solutions:" %}
{% for passage in pool.passages.all %}
@@ -61,6 +55,12 @@
{% endif %}
+
+
+ {% trans "Passages" %}
+
+ {% render_table passages %}
+
{% trans "Add passage" as modal_title %}
{% trans "Add" as modal_button %}
{% url "participation:passage_create" pk=pool.pk as modal_action %}
diff --git a/apps/participation/views.py b/apps/participation/views.py
index 9a558fd..cc45a81 100644
--- a/apps/participation/views.py
+++ b/apps/participation/views.py
@@ -26,7 +26,7 @@ from tfjm.views import AdminMixin
from .forms import JoinTeamForm, NoteForm, ParticipationForm, PassageForm, PoolForm, PoolTeamsForm, \
RequestValidationForm, TeamForm, TournamentForm, ValidateParticipationForm, SolutionForm, SynthesisForm
from .models import Note, Participation, Passage, Pool, Team, Tournament, Solution, Synthesis
-from .tables import TeamTable, TournamentTable, ParticipationTable, PoolTable, NoteTable
+from .tables import NoteTable, PassageTable, PoolTable, TeamTable, TournamentTable, ParticipationTable
class CreateTeamView(LoginRequiredMixin, CreateView):
@@ -489,6 +489,8 @@ class PoolDetailView(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
+ context["passages"] = PassageTable(self.object.passages.all())
+
notes = dict()
for participation in self.object.participations.all():
notes[participation] = self.object.average(participation)
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index 03aecd8..a2750d7 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TFJM\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-01-14 19:22+0100\n"
+"POT-Creation-Date: 2021-01-14 19:30+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO \n"
"Language-Team: LANGUAGE \n"
@@ -293,7 +293,7 @@ msgstr "solution défendue"
msgid "Problem #{problem}"
msgstr "Problème n°{problem}"
-#: apps/participation/models.py:356
+#: apps/participation/models.py:356 apps/participation/tables.py:105
msgid "defender"
msgstr "défenseur"
@@ -478,9 +478,9 @@ msgstr "Rejoindre"
#: apps/participation/templates/participation/passage_detail.html:44
#: apps/participation/templates/participation/passage_detail.html:100
#: apps/participation/templates/participation/passage_detail.html:105
-#: apps/participation/templates/participation/pool_detail.html:58
-#: apps/participation/templates/participation/pool_detail.html:70
-#: apps/participation/templates/participation/pool_detail.html:75
+#: apps/participation/templates/participation/pool_detail.html:52
+#: apps/participation/templates/participation/pool_detail.html:68
+#: apps/participation/templates/participation/pool_detail.html:73
#: apps/participation/templates/participation/team_detail.html:84
#: apps/participation/templates/participation/team_detail.html:143
#: apps/participation/templates/participation/tournament_form.html:12
@@ -646,34 +646,34 @@ msgid "Juries:"
msgstr "Jurys :"
#: apps/participation/templates/participation/pool_detail.html:28
-msgid "Passages:"
-msgstr "Passages :"
-
-#: apps/participation/templates/participation/pool_detail.html:34
msgid "Defended solutions:"
msgstr "Solutions défendues :"
-#: apps/participation/templates/participation/pool_detail.html:44
+#: apps/participation/templates/participation/pool_detail.html:38
#: apps/participation/templates/participation/tournament_detail.html:79
msgid "Ranking"
msgstr "Classement"
-#: apps/participation/templates/participation/pool_detail.html:57
-#: apps/participation/templates/participation/pool_detail.html:64
+#: apps/participation/templates/participation/pool_detail.html:51
+#: apps/participation/templates/participation/pool_detail.html:62
msgid "Add passage"
msgstr "Ajouter un passage"
-#: apps/participation/templates/participation/pool_detail.html:59
-#: apps/participation/templates/participation/pool_detail.html:74
+#: apps/participation/templates/participation/pool_detail.html:53
+#: apps/participation/templates/participation/pool_detail.html:72
msgid "Update teams"
msgstr "Modifier les équipes"
-#: apps/participation/templates/participation/pool_detail.html:65
+#: apps/participation/templates/participation/pool_detail.html:60
+msgid "Passages"
+msgstr "Passages"
+
+#: apps/participation/templates/participation/pool_detail.html:63
#: apps/participation/templates/participation/tournament_detail.html:91
msgid "Add"
msgstr "Ajouter"
-#: apps/participation/templates/participation/pool_detail.html:69
+#: apps/participation/templates/participation/pool_detail.html:67
#: apps/participation/templates/participation/pool_form.html:11
msgid "Update pool"
msgstr "Modifier la poule"