Beispiel #1
0
def create_match(request, ladder_id):
    ladder = get_ladder_or_404(pk=ladder_id)
    games = int_or_none(request.GET.get('games'))
    if request.POST:
        form = get_match_form(ladder, post_dictionary=request.POST, number_of_games=games)
        if form.is_valid():
            match = form.save()
            adjust_rankings(match)
            form = get_match_form(ladder, number_of_games=games)
            form.success = "Match created successfully"
    else:
        form = get_match_form(ladder, number_of_games=games)
    return view_with_ladder(request, ladder, 'leaderboard/content/match_entry_form.html',
        context={'form': form, 'ladder_players': get_ladder_players_for_match_entry(ladder)}
    )
Beispiel #2
0
def display_ladder(request, ladder_id):
    ladder = get_ladder_or_404(pk=ladder_id)
    return view_with_ladder(request, ladder, 'leaderboard/content/ladder.html')
Beispiel #3
0
def ladder_page(request, ladder_id):
    ladder = get_ladder_or_404(pk=ladder_id)
    return view_with_ladder(request, ladder, 'basic/ladder_page.html',
        {'navbar_active': 'ladder'}
    )
Beispiel #4
0
def matches_page(request, ladder_id):
    ladder = get_ladder_or_404(pk=ladder_id)
    match_id = int_or_none(request.GET.get('id', None))
    return view_with_ladder(request, ladder, 'leaderboard/matches_page.html', {'navbar_active': 'matches',
        'match_id': match_id, 'match_feed_size': 10,
    })