diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 5d43543..ede4e07 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -330,35 +330,16 @@ class Match(TournamentSubModel): else: return 'À suivre' else: - # Get the tournament and timezone - tournament = self.get_tournament() - timezone = tournament.timezone() + # timezoned_datetime = timezone.localtime(self.start_date) + timezone = self.get_tournament().timezone() local_start = self.start_date.astimezone(timezone) - - 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') - + time_format ='l H:i' + if self.get_tournament().day_duration >= 7: + time_format = 'D. d F à H:i' if self.confirmed: - return formatted_date + return formats.date_format(local_start, format=time_format) else: - return f"Estimée : {formatted_date}" + return f"Estimée : {formats.date_format(local_start, format=time_format)}" else: return 'À venir...'