From 7df3242634a42b4bf5979431a17b45514137e4b8 Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 21 Sep 2024 11:37:46 +0200 Subject: [PATCH 1/2] fix stuff website match and broadcast --- tournaments/models/group_stage.py | 2 +- tournaments/models/round.py | 1 - tournaments/models/tournament.py | 12 ++++++++---- tournaments/templates/tournaments/matches.html | 4 +++- .../templates/tournaments/navigation_tournament.html | 2 +- tournaments/views.py | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tournaments/models/group_stage.py b/tournaments/models/group_stage.py index 85415a9..a902a93 100644 --- a/tournaments/models/group_stage.py +++ b/tournaments/models/group_stage.py @@ -104,7 +104,7 @@ class GroupStage(models.Model): def has_at_least_one_started_match(self): for match in self.match_set.all(): - if match.start_date: + if match.start_date is not None and match.start_date <= timezone.now(): return True return False diff --git a/tournaments/models/round.py b/tournaments/models/round.py index 0ad10e3..3c5eb2e 100644 --- a/tournaments/models/round.py +++ b/tournaments/models/round.py @@ -58,7 +58,6 @@ class Round(models.Model): def get_matches_recursive(self, hide_empty_matches): matches = list(self.match_set.all()) # Retrieve matches associated with the current round - matches = [m for m in matches if m.should_appear()] if hide_empty_matches: matches = [m for m in matches if m.should_appear()] else: diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 0b43c87..586105d 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -337,13 +337,15 @@ class Tournament(models.Model): def match_groups(self, broadcasted, group_stage_id, round_id): + display_brackets = self.display_matches() + match_groups = [] if group_stage_id: group_stage = self.groupstage_set.filter(id=group_stage_id).first() match_groups.append(self.group_stage_match_group(group_stage, broadcasted, hide_empty_matches=False)) elif round_id: round = self.round_set.filter(id=round_id).first() - if round: + if round and display_brackets is True: match_groups = self.round_match_groups(round, broadcasted, hide_empty_matches=False) else: match_groups = self.all_groups(broadcasted) @@ -352,8 +354,10 @@ class Tournament(models.Model): def all_groups(self, broadcasted): groups = [] - for round in self.round_set.filter(parent=None).all().order_by('index'): - groups.extend(self.round_match_groups(round, broadcasted, hide_empty_matches=True)) + + if self.display_matches(): + for round in self.round_set.filter(parent=None).all().order_by('index'): + groups.extend(self.round_match_groups(round, broadcasted, hide_empty_matches=True)) if self.display_group_stages(): for group_stage in self.groupstage_set.all().order_by('index'): @@ -685,7 +689,7 @@ class Tournament(models.Model): def has_all_group_stages_started(self): for group_stage in self.groupstage_set.all(): - if group_stage.has_at_least_one_started_match() == False: + if group_stage.has_at_least_one_started_match() is False: return False return True diff --git a/tournaments/templates/tournaments/matches.html b/tournaments/templates/tournaments/matches.html index 9080ded..0f5090c 100644 --- a/tournaments/templates/tournaments/matches.html +++ b/tournaments/templates/tournaments/matches.html @@ -9,7 +9,7 @@ {% include 'tournaments/navigation_tournament.html' %} -{% if tournament.display_matches %} +{% if tournament.display_matches or tournament.display_group_stages %} {% if rounds or group_stages %} {% endif %} diff --git a/tournaments/templates/tournaments/navigation_tournament.html b/tournaments/templates/tournaments/navigation_tournament.html index cb26aad..b219178 100644 --- a/tournaments/templates/tournaments/navigation_tournament.html +++ b/tournaments/templates/tournaments/navigation_tournament.html @@ -2,7 +2,7 @@ Informations - {% if tournament.display_matches %} + {% if tournament.display_matches or tournament.display_group_stages %} Matches {% endif %} diff --git a/tournaments/views.py b/tournaments/views.py index 73a2781..cd5ab8e 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -151,7 +151,7 @@ def tournament(request, tournament_id): print(len(rounds)) print(len(group_stages)) - if tournament.display_matches(): + if tournament.display_matches() or tournament.display_group_stages(): return render(request, 'tournaments/matches.html', { 'tournament': tournament, 'rounds': rounds, From 01a91e2dbf7e9520c17f80163db764f41b3a9ea5 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 21 Jan 2025 13:12:58 +0100 Subject: [PATCH 2/2] fix email settings --- padelclub_backend/settings_app.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/padelclub_backend/settings_app.py b/padelclub_backend/settings_app.py index 54d6d79..be8a614 100644 --- a/padelclub_backend/settings_app.py +++ b/padelclub_backend/settings_app.py @@ -16,18 +16,18 @@ REST_FRAMEWORK = { # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # EMAIL_HOST = 'smtp-xlr.alwaysdata.net' # EMAIL_PORT = 587 -# EMAIL_HOST_USER = 'automatic@padelclub.app' -# EMAIL_HOST_PASSWORD = 'XLRSport$2024' +EMAIL_HOST_USER = 'automatic@padelclub.app' +EMAIL_HOST_PASSWORD = 'XLR@Sport@2024' # EMAIL_USE_TLS = True -# DEFAULT_FROM_EMAIL = 'Padel Club ' +DEFAULT_FROM_EMAIL = 'Padel Club ' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp-xlr.alwaysdata.net' EMAIL_PORT = 587 -EMAIL_HOST_USER = 'xlr@alwaysdata.net' -EMAIL_HOST_PASSWORD = 'XLRSport$2024' +#EMAIL_HOST_USER = 'xlr@alwaysdata.net' +#EMAIL_HOST_PASSWORD = 'XLRSport$2024' EMAIL_USE_TLS = True -DEFAULT_FROM_EMAIL = 'Padel Club ' +#DEFAULT_FROM_EMAIL = 'Padel Club ' CACHES = { 'default': {