From 7e625a4652d3cd4e13e07383005e2ee5ccad79e3 Mon Sep 17 00:00:00 2001 From: Raz Date: Tue, 24 Sep 2024 14:58:46 +0200 Subject: [PATCH] phone length update and acronym / club short title --- ...87_alter_playerregistration_phone_number.py | 18 ++++++++++++++++++ tournaments/models/club.py | 6 ++++++ tournaments/models/event.py | 2 +- tournaments/models/player_registration.py | 2 +- .../templates/tournaments/tournament_row.html | 2 +- 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tournaments/migrations/0087_alter_playerregistration_phone_number.py diff --git a/tournaments/migrations/0087_alter_playerregistration_phone_number.py b/tournaments/migrations/0087_alter_playerregistration_phone_number.py new file mode 100644 index 0000000..9c7ecce --- /dev/null +++ b/tournaments/migrations/0087_alter_playerregistration_phone_number.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.11 on 2024-09-24 12:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tournaments', '0086_merge_20240919_1142'), + ] + + operations = [ + migrations.AlterField( + model_name='playerregistration', + name='phone_number', + field=models.CharField(blank=True, max_length=50, null=True), + ), + ] diff --git a/tournaments/models/club.py b/tournaments/models/club.py index dc68aac..d2b2f29 100644 --- a/tournaments/models/club.py +++ b/tournaments/models/club.py @@ -43,3 +43,9 @@ class Club(models.Model): return f"{self.zip_code} {self.city}" else: return "" + + def computedShortTitle(self): + if len(self.name) > 15: + return self.acronym + else: + return self.name diff --git a/tournaments/models/event.py b/tournaments/models/event.py index bed7bef..89d11c9 100644 --- a/tournaments/models/event.py +++ b/tournaments/models/event.py @@ -22,7 +22,7 @@ class Event(models.Model): def display_name(self): if self.club and self.club.name and self.name: - return self.club.acronym + " " + self.name + return self.club.computedShortTitle() + " " + self.name if self.name: return self.name elif self.club and self.club.name: diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py index 560bc54..6b10736 100644 --- a/tournaments/models/player_registration.py +++ b/tournaments/models/player_registration.py @@ -24,7 +24,7 @@ class PlayerRegistration(models.Model): assimilation = models.CharField(max_length=50, null=True, blank=True) #beachpadel - phone_number = models.CharField(max_length=15, null=True, blank=True) + phone_number = models.CharField(max_length=50, null=True, blank=True) email = models.CharField(max_length=50, null=True, blank=True) birthdate = models.CharField(max_length=50, null=True, blank=True) diff --git a/tournaments/templates/tournaments/tournament_row.html b/tournaments/templates/tournaments/tournament_row.html index 1be4d1f..6d3492b 100644 --- a/tournaments/templates/tournaments/tournament_row.html +++ b/tournaments/templates/tournaments/tournament_row.html @@ -16,7 +16,7 @@ {% endif %}
-
{{ tournament.event.club.acronym }}
+
{{ tournament.event.club.computedShortTitle }}
{% if tournament.event.name %}
{{ tournament.event.name }}
{% endif %}