From 60f5236deee5b6495812af6b3d1cba8a710af0fb Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Mon, 28 Apr 2025 20:35:23 +0200 Subject: [PATCH] =?UTF-8?q?Affichage=20du=20tournoi=20dans=20la=20liste=20?= =?UTF-8?q?des=20r=C3=A9ponses=20=C3=A0=20un=20questionnaire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- survey/models.py | 4 ++-- survey/templates/survey/survey_detail.html | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/survey/models.py b/survey/models.py index 4ada6fa..696f3fe 100644 --- a/survey/models.py +++ b/survey/models.py @@ -70,7 +70,7 @@ class Survey(models.Model): teams = Team.objects.filter(participation__valid=True) if self.tournament: teams = teams.filter(participation__tournament=self.tournament) - return teams.all() + return teams.order_by('participation__tournament__name', 'trigram').all() else: if self.invite_coaches: registrations = ParticipantRegistration.objects.filter(team__participation__valid=True) @@ -78,7 +78,7 @@ class Survey(models.Model): registrations = StudentRegistration.objects.filter(team__participation__valid=True) if self.tournament: registrations = registrations.filter(team__participation__tournament=self.tournament) - return registrations.all() + return registrations.order_by('team__participation__tournament__name', 'team__trigram').all() @property def completed(self): diff --git a/survey/templates/survey/survey_detail.html b/survey/templates/survey/survey_detail.html index ca3be9b..14df805 100644 --- a/survey/templates/survey/survey_detail.html +++ b/survey/templates/survey/survey_detail.html @@ -48,6 +48,7 @@ {% trans "participant"|capfirst %} + {% trans "tournament"|capfirst %} {% trans "completed"|capfirst %} @@ -56,8 +57,10 @@ {% if survey.invite_team %} {% trans "Team" %} {{ participant.name }} ({{ participant.trigram }}) + {{ participant.participation.tournament.name }} {% else %} {{ participant.user.first_name }} {{ participant.user.last_name }} ({% trans "team" %} {{ participant.team.trigram }}) + {{ participant.team.participation.tournament.name }} {% endif %} {% if participant in survey.completed.all %} {% trans "Yes" %}