From eb25d0e609de0e34b28a831e57fd450a242846e2 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Sun, 2 Nov 2025 15:08:16 +0100 Subject: [PATCH] Add get_last_name method for anonymous players --- tournaments/models/player_registration.py | 5 +++++ tournaments/models/team_registration.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py index 6a2a98c..df281cb 100644 --- a/tournaments/models/player_registration.py +++ b/tournaments/models/player_registration.py @@ -235,3 +235,8 @@ class PlayerRegistration(TournamentSubModel): if self.contact_email: return self.contact_email return self.email + + def get_last_name(self): + if self.is_anonymous: + return "Anonyme" + return self.last_name diff --git a/tournaments/models/team_registration.py b/tournaments/models/team_registration.py index 514730f..a33d72d 100644 --- a/tournaments/models/team_registration.py +++ b/tournaments/models/team_registration.py @@ -109,7 +109,7 @@ class TeamRegistration(TournamentSubModel): def formatted_team_names(self): if self.name: return self.name - names = [pr.last_name for pr in self.players_sorted_by_rank][:2] # Take max first 2 + names = [pr.get_last_name() for pr in self.players_sorted_by_rank][:2] # Take max first 2 joined_names = " / ".join(names) if joined_names: return f"Paire {joined_names}"