|
|
|
@ -20,13 +20,6 @@ def index(request): |
|
|
|
future_tournaments = Tournament.objects.filter(end_date__isnull=True, start_date__gt=today).order_by('start_date') |
|
|
|
future_tournaments = Tournament.objects.filter(end_date__isnull=True, start_date__gt=today).order_by('start_date') |
|
|
|
live_tournaments = Tournament.objects.filter(end_date__isnull=True, start_date__lte=today).order_by('start_date') |
|
|
|
live_tournaments = Tournament.objects.filter(end_date__isnull=True, start_date__lte=today).order_by('start_date') |
|
|
|
ended_tournaments = Tournament.objects.filter(end_date__isnull=False).order_by('start_date') |
|
|
|
ended_tournaments = Tournament.objects.filter(end_date__isnull=False).order_by('start_date') |
|
|
|
# template = loader.get_template('tournaments/tournaments.html') |
|
|
|
|
|
|
|
# context = { |
|
|
|
|
|
|
|
# 'future': future_tournaments, |
|
|
|
|
|
|
|
# 'live': live_tournaments, |
|
|
|
|
|
|
|
# 'ended': ended_tournaments, |
|
|
|
|
|
|
|
# } |
|
|
|
|
|
|
|
# return HttpResponse(template.render(context, request)) |
|
|
|
|
|
|
|
return render( |
|
|
|
return render( |
|
|
|
request, |
|
|
|
request, |
|
|
|
"tournaments/tournaments.html", |
|
|
|
"tournaments/tournaments.html", |
|
|
|
@ -34,8 +27,7 @@ def index(request): |
|
|
|
'future': future_tournaments, |
|
|
|
'future': future_tournaments, |
|
|
|
'live': live_tournaments, |
|
|
|
'live': live_tournaments, |
|
|
|
'ended': ended_tournaments, |
|
|
|
'ended': ended_tournaments, |
|
|
|
}, |
|
|
|
} |
|
|
|
content_type="text/html", |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
def tournament(request, tournament_id): |
|
|
|
def tournament(request, tournament_id): |
|
|
|
@ -43,39 +35,18 @@ def tournament(request, tournament_id): |
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
live_matches = list(tournament.live_matches()) |
|
|
|
live_matches = list(tournament.live_matches()) |
|
|
|
|
|
|
|
|
|
|
|
template = loader.get_template('tournaments/matches.html') |
|
|
|
return render(request, 'tournaments/matches.html', { |
|
|
|
context = { |
|
|
|
|
|
|
|
'matches': live_matches, |
|
|
|
'matches': live_matches, |
|
|
|
} |
|
|
|
}) |
|
|
|
return HttpResponse(template.render(context, request)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def tournament(request, tournament_id): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
|
|
|
|
# today = date.today() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# future_matches = Match.objects.filter(end_date__isnull=True, start_date__gt=today).order_by('start_date') |
|
|
|
|
|
|
|
# live_matches = Match.objects.filter(end_date__isnull=True, start_date__lte=today).order_by('start_date') |
|
|
|
|
|
|
|
# ended_matches = Match.objects.filter(end_date__isnull=False).order_by('start_date') |
|
|
|
|
|
|
|
# template = loader.get_template('tournaments/tournament.html') |
|
|
|
|
|
|
|
# context = { |
|
|
|
|
|
|
|
# 'future': future_matches, |
|
|
|
|
|
|
|
# 'live': live_matches, |
|
|
|
|
|
|
|
# 'ended': ended_matches, |
|
|
|
|
|
|
|
# } |
|
|
|
|
|
|
|
# return HttpResponse(template.render(context, request)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tournament_summons(request, tournament_id): |
|
|
|
def tournament_summons(request, tournament_id): |
|
|
|
|
|
|
|
|
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
team_summons = tournament.team_summons() |
|
|
|
team_summons = tournament.team_summons() |
|
|
|
|
|
|
|
|
|
|
|
template = loader.get_template('tournaments/summons.html') |
|
|
|
return render(request, 'tournaments/summons.html', { |
|
|
|
context = { |
|
|
|
|
|
|
|
'team_summons': team_summons, |
|
|
|
'team_summons': team_summons, |
|
|
|
} |
|
|
|
}) |
|
|
|
return HttpResponse(template.render(context, request)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tournament_json(request, tournament_id): |
|
|
|
def tournament_json(request, tournament_id): |
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
tournament = get_object_or_404(Tournament, pk=tournament_id) |
|
|
|
@ -83,17 +54,6 @@ def tournament_json(request, tournament_id): |
|
|
|
data = json.dumps(live_matches, default=vars) |
|
|
|
data = json.dumps(live_matches, default=vars) |
|
|
|
return HttpResponse(data, content_type='application/json') |
|
|
|
return HttpResponse(data, content_type='application/json') |
|
|
|
|
|
|
|
|
|
|
|
# def index(request): |
|
|
|
|
|
|
|
# club = Club.objects.first() |
|
|
|
|
|
|
|
# live_matches = Match.objects.filter(enddate__isnull=True).order_by('court') |
|
|
|
|
|
|
|
# ended_matches = Match.objects.filter(enddate__isnull=False).order_by('court') |
|
|
|
|
|
|
|
# template = loader.get_template('scores/index.html') |
|
|
|
|
|
|
|
# context = { |
|
|
|
|
|
|
|
# 'club': club, |
|
|
|
|
|
|
|
# 'live_matches': live_matches, |
|
|
|
|
|
|
|
# 'ended_matches': ended_matches, |
|
|
|
|
|
|
|
# } |
|
|
|
|
|
|
|
# return HttpResponse(template.render(context, request)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api_view(['GET']) |
|
|
|
@api_view(['GET']) |
|
|
|
def user_by_token(request): |
|
|
|
def user_by_token(request): |
|
|
|
|