diff --git a/tournaments/templates/tournaments/broadcast/broadcasted_match.html b/tournaments/templates/tournaments/broadcast/broadcasted_match.html
index 1878786..ef51dd8 100644
--- a/tournaments/templates/tournaments/broadcast/broadcasted_match.html
+++ b/tournaments/templates/tournaments/broadcast/broadcasted_match.html
@@ -21,24 +21,31 @@
-
-
-
+
+
+
+
+
+
+ }" x-html="showWalkOut(match, match.teams[i-1])">
diff --git a/tournaments/views.py b/tournaments/views.py
index 3cd0c66..ceb77fa 100644
--- a/tournaments/views.py
+++ b/tournaments/views.py
@@ -411,7 +411,11 @@ def activate(request, uidb64, token):
if user is not None and account_activation_token.check_token(user, token):
user.is_active = True
user.save()
- login(request, user)
+
+ # Specify the authentication backend when logging in
+ from django.contrib.auth import login
+ login(request, user, backend='django.contrib.auth.backends.ModelBackend')
+
next_url = request.GET.get('next', '/')
return redirect(next_url)
else:
@@ -724,11 +728,14 @@ def my_tournaments(request):
'user_name': user.username
})
-class ProfileUpdateView(UpdateView):
+from django.contrib.auth.mixins import LoginRequiredMixin
+
+class ProfileUpdateView(LoginRequiredMixin, UpdateView):
model = CustomUser
form_class = ProfileUpdateForm
template_name = 'profile.html'
success_url = reverse_lazy('profile')
+ login_url = '/login/' # Specify where to redirect if user is not logged in
def get_object(self, queryset=None):
return self.request.user
@@ -831,19 +838,24 @@ def get_file_data(zip_file, file_path):
raise Exception(f"Invalid JSON in file {file_path}")
def team_details(request, tournament_id, team_id):
+ # First check if team_id is None or invalid
+ if team_id is None or team_id == 'None':
+ # Redirect to tournament page or show an error
+ return redirect('tournament-info', tournament_id=tournament_id)
+
tournament = get_object_or_404(Tournament, id=tournament_id)
- team = get_object_or_404(TeamRegistration, id=team_id)
- print(f"Processing team {team_id} in tournament {tournament_id}")
+ try:
+ team = get_object_or_404(TeamRegistration, id=team_id)
+ except (ValueError, ValidationError):
+ # Handle invalid UUID
+ return redirect('tournament-info', tournament_id=tournament_id)
# Get all matches for this team
all_matches = team.get_matches()
- print(f"Total matches found: {all_matches.count()}")
- print("Match details:")
- for match in all_matches:
- print(f"- Match {match.id}: start={match.start_date}, end={match.end_date}")
return render(request, 'tournaments/team_details.html', {
'tournament': tournament,
'team': team,
- 'debug': True # Set to False in production
+ 'matches': all_matches,
+ 'debug': False # Set to False in production
})