From 7e84e3ab9ee6aed59493ea702ae57c5af327aeec Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 13 Mar 2025 14:18:09 +0100 Subject: [PATCH] fix naming crash --- tournaments/models/tournament.py | 6 +++--- tournaments/views.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 67e3a05..a782e10 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -1013,9 +1013,9 @@ class Tournament(BaseModel): def is_build_and_not_empty(self): if hasattr(self, '_prefetched_objects_cache'): # Use prefetched data if available - has_group_stages = 'groupstage_set' in self._prefetched_objects_cache and len(self.group_stages.all()) > 0 - has_rounds = 'round_set' in self._prefetched_objects_cache and len(self.rounds.all()) > 0 - has_team_registrations = 'teamregistration_set' in self._prefetched_objects_cache and len(self.team_registrations.all()) >= 4 + has_group_stages = 'group_stages' in self._prefetched_objects_cache and len(self.group_stages.all()) > 0 + has_rounds = 'rounds' in self._prefetched_objects_cache and len(self.rounds.all()) > 0 + has_team_registrations = 'team_registrations' in self._prefetched_objects_cache and len(self.team_registrations.all()) >= 4 else: # Fall back to database queries if not prefetched has_group_stages = self.group_stages.count() > 0 diff --git a/tournaments/views.py b/tournaments/views.py index 774f6cb..3f70c3b 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -159,9 +159,9 @@ def tournaments_query(query, club_id, ascending, limit=None): sortkey = '-start_date' queryset = Tournament.objects.filter(*queries).prefetch_related( - 'groupstage_set', - 'round_set', - 'teamregistration_set', + 'group_stages', + 'rounds', + 'team_registrations', ).order_by(sortkey) # Apply limit directly in the database query