From 382f505bdb3b53d30bfc69ad3a5263384dbf2392 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Mon, 9 Sep 2024 19:18:19 +0200 Subject: [PATCH] add age category info --- tournaments/models/enums.py | 14 +++++++------- tournaments/models/tournament.py | 5 +++++ .../templates/tournaments/tournament_row.html | 3 +++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tournaments/models/enums.py b/tournaments/models/enums.py index 76a340b..0a3a1b9 100644 --- a/tournaments/models/enums.py +++ b/tournaments/models/enums.py @@ -25,13 +25,13 @@ class FederalLevelCategory(models.IntegerChoices): class FederalAgeCategory(models.IntegerChoices): UNLISTED = 0, '' - A11_12 = 120, 'A11_12' - A13_14 = 140, 'A13_14' - A15_16 = 160, 'A15_16' - A17_18 = 180, 'A17_18' - SENIOR = 200, 'SENIOR' - A45 = 450, 'A45' - A55 = 550, 'A55' + A11_12 = 120, 'U12' + A13_14 = 140, 'U14' + A15_16 = 160, 'U16' + A17_18 = 180, 'U18' + SENIOR = 200, 'Senior' + A45 = 450, '+45 ans' + A55 = 550, '+55 ans' class FederalMatchCategory(models.IntegerChoices): TWO_SETS = 0, 'Two sets' diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 3627af7..0b43c87 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -119,6 +119,11 @@ class Tournament(models.Model): def category(self): return self.get_federal_category_display() + def age(self): + if self.federal_age_category == 0: + return None + return self.get_federal_age_category_display() + def formatted_start_date(self): return self.start_date.strftime("%d/%m/%y") diff --git a/tournaments/templates/tournaments/tournament_row.html b/tournaments/templates/tournaments/tournament_row.html index 869290c..1be4d1f 100644 --- a/tournaments/templates/tournaments/tournament_row.html +++ b/tournaments/templates/tournaments/tournament_row.html @@ -3,6 +3,9 @@
{{ tournament.level }}
{{ tournament.category }}
+ {% if tournament.age %} +
{{ tournament.age }}
+ {% endif %}
{{ tournament.event.club.name }}