diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 25f0a15..5d43543 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -330,16 +330,35 @@ class Match(TournamentSubModel): else: return 'À suivre' else: - # timezoned_datetime = timezone.localtime(self.start_date) - timezone = self.get_tournament().timezone() + # Get the tournament and timezone + tournament = self.get_tournament() + timezone = tournament.timezone() local_start = self.start_date.astimezone(timezone) - time_format ='l H:i' - if self.get_tournament().day_duration >= 7: - time_format = 'l d M à H:i' + + if tournament.day_duration >= 7: + # Use the custom month property from tournament + # First create a date object with the same date as local_start + # so we can use tournament's week_day and month properties + + # Format the hour and minute + hour = local_start.hour + minute = local_start.minute + time_str = f"{hour:02d}:{minute:02d}" + + # Create the formatted date string using tournament properties and local_start + weekday = formats.date_format(local_start, format='D') + '.' # Abbreviated weekday with period + day = local_start.day + month = tournament.month # Use the custom month property + + formatted_date = f"{weekday} {day} {month} à {time_str}" + else: + # For shorter durations, just use the weekday and time + formatted_date = formats.date_format(local_start, format='l H:i') + if self.confirmed: - return formats.date_format(local_start, format=time_format) + return formatted_date else: - return f"Estimée : {formats.date_format(local_start, format=time_format)}" + return f"Estimée : {formatted_date}" else: return 'À venir...' @@ -460,7 +479,10 @@ class Match(TournamentSubModel): bracket_name = "Match #" + f"{self.index_in_round() + 1}" ended = self.end_date is not None - live_format = "Format " + FederalMatchCategory(self.format).format_label_short + live_format = "Format " + if self.get_tournament().day_duration >= 7: + live_format = "" + live_format = live_format + FederalMatchCategory(self.format).format_label_short tournament_title = None if event_mode is True: diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 86c380d..7c78b96 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -596,7 +596,7 @@ class Tournament(BaseModel): # Format the date timezone = first_match.get_tournament().timezone() local_start = first_match.start_date.astimezone(timezone) - time_format = 'l d M' + time_format = 'l d F' formatted_schedule = f" - {formats.date_format(local_start, format=time_format)}" return MatchGroup(name, live_matches, formatted_schedule, round_id, round_index) diff --git a/tournaments/templates/admin/tournaments/dashboard.html b/tournaments/templates/admin/tournaments/dashboard.html index b6f6fb1..339224d 100644 --- a/tournaments/templates/admin/tournaments/dashboard.html +++ b/tournaments/templates/admin/tournaments/dashboard.html @@ -13,7 +13,35 @@ {% block content %}