|
|
|
|
@ -2,6 +2,8 @@ from django.shortcuts import render, get_object_or_404 |
|
|
|
|
from django.http import HttpResponse |
|
|
|
|
from django.utils.encoding import force_str |
|
|
|
|
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode |
|
|
|
|
from django.urls import reverse |
|
|
|
|
|
|
|
|
|
from .tokens import account_activation_token |
|
|
|
|
|
|
|
|
|
from tournaments.models import group_stage |
|
|
|
|
@ -24,6 +26,8 @@ from django.http import JsonResponse |
|
|
|
|
from django.db.models import Q |
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
from qr_code.qrcode.utils import QRCodeOptions |
|
|
|
|
|
|
|
|
|
def index(request): |
|
|
|
|
|
|
|
|
|
today = date.today() |
|
|
|
|
@ -103,6 +107,8 @@ def tournament_broadcasted_summons(request, tournament_id): |
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
return render(request, 'tournaments/broadcasted_summons.html', { |
|
|
|
|
'tournament': tournament, |
|
|
|
|
'qr_code_url': qr_code_url(request, tournament_id), |
|
|
|
|
'qr_code_options': qr_code_options(), |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def tournament_summons_json(request, tournament_id): |
|
|
|
|
@ -115,18 +121,31 @@ def tournament_broadcast_home(request, tournament_id): |
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
return render(request, 'tournaments/broadcast.html', { |
|
|
|
|
'tournament': tournament, |
|
|
|
|
'qr_code_url': qr_code_url(request, tournament_id), |
|
|
|
|
'qr_code_options': qr_code_options(), |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def automatic_broadcast(request, tournament_id): |
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
return render(request, 'tournaments/broadcasted_auto.html', { |
|
|
|
|
'tournament': tournament, |
|
|
|
|
'qr_code_url': qr_code_url(request, tournament_id), |
|
|
|
|
'qr_code_options': qr_code_options(), |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def qr_code_url(request, tournament_id): |
|
|
|
|
qr_code_url = reverse('tournament', args=[tournament_id]) |
|
|
|
|
return request.build_absolute_uri(qr_code_url) |
|
|
|
|
|
|
|
|
|
def qr_code_options(): |
|
|
|
|
return QRCodeOptions(size=10, border=4, error_correction='L') |
|
|
|
|
|
|
|
|
|
def tournament_matches(request, tournament_id): |
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
return render(request, 'tournaments/broadcasted_matches.html', { |
|
|
|
|
'tournament': tournament, |
|
|
|
|
'qr_code_url': qr_code_url(request, tournament_id), |
|
|
|
|
'qr_code_options': qr_code_options(), |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def broadcast_json(request, tournament_id): |
|
|
|
|
@ -155,6 +174,8 @@ def tournament_broadcasted_group_stages(request, tournament_id): |
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
return render(request, 'tournaments/broadcasted_group_stages.html', { |
|
|
|
|
'tournament': tournament, |
|
|
|
|
'qr_code_url': qr_code_url(request, tournament_id), |
|
|
|
|
'qr_code_options': qr_code_options(), |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
def tournament_live_group_stage_json(request, tournament_id): |
|
|
|
|
|