From bfba07b7a2c9817eb22c673ae79b056a12ad514b Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Tue, 5 May 2020 14:17:06 +0200 Subject: [PATCH] Display teams selected for the final --- apps/tournament/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/tournament/models.py b/apps/tournament/models.py index 2c8095a..c542590 100644 --- a/apps/tournament/models.py +++ b/apps/tournament/models.py @@ -79,6 +79,10 @@ class Tournament(models.Model): verbose_name=_("year"), ) + @property + def teams(self): + return self._teams if not self.final else Team.objects.filter(selected_for_final=True) + @property def linked_organizers(self): return [''.format(url=reverse_lazy("member:information", args=(user.pk,))) + str(user) + '' @@ -122,7 +126,7 @@ class Team(models.Model): tournament = models.ForeignKey( Tournament, on_delete=models.PROTECT, - related_name="teams", + related_name="_teams", verbose_name=_("tournament"), )