Laurent 10 months ago
commit a705908071
  1. 19
      tournaments/templates/tournaments/broadcast/broadcasted_match.html
  2. 30
      tournaments/views.py

@ -21,24 +21,31 @@
</div>
<div class="scores">
<template x-for="score in match.teams[i-1].scores">
<span class="score bold w30px" :class="match.teams[i-1].is_winner ? 'winner' : ''" x-text="score"></span>
<span class="score ws"
:class="{
'w35px': score.tiebreak,
'w30px': !score.tiebreak,
'winner': match.teams[i-1].is_winner
}"
>
<span x-text="score.main"></span>
<template x-if="score.tiebreak">
<sup x-text="score.tiebreak"></sup>
</template>
</span>
</template>
<span x-data="{
showWalkOut(match, team) {
let html = ``
if (match.has_walk_out) {
html += `<span class='score bold w60px'>`
if (team.walk_out) html += `WO`
html += `</span>`
}
return html
},
}" x-html="showWalkOut(match, match.teams[i-1])">
}" x-html="showWalkOut(match, match.teams[i-1])">
</span>
</div>
</div>

@ -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
})

Loading…
Cancel
Save