From d6a4a471edc333aba2b261af064739915af24d5e Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 29 May 2024 12:24:55 +0200 Subject: [PATCH] Fix issue where there is no club --- tournaments/models/match.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tournaments/models/match.py b/tournaments/models/match.py index b8893b9..1e446e0 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -34,7 +34,12 @@ class Match(models.Model): return self.group_stage.tournament def court_name(self, index): - return self.tournament().event.club.court_name(index) + club = self.tournament().event.club + if club: + return club.court_name(index) + elif index is not None: + return f"Terrain {index + 1}" + return "" def backup_name(self): items = []