Ejemplo n.º 1
0
def edit(request):
	tournament = Tournament.get()
	try:
		number = int(request.POST['number'])
		tournament.matches[number]['top_player'] = request.POST.get('top_player')
		tournament.matches[number]['bottom_player'] = request.POST.get('bottom_player')
		tournament.matches[number]['top_score'] = request.POST.get('top_score')
		if tournament.matches[number]['top_score']:
			tournament.matches[number]['top_score'] = int(tournament.matches[number]['top_score'])
		tournament.matches[number]['bottom_score'] = request.POST.get('bottom_score')
		if tournament.matches[number]['bottom_score']:
			tournament.matches[number]['bottom_score'] = int(tournament.matches[number]['bottom_score'])
		tournament.save()
	except ValueError:
		pass

	return redirect('tournaments.show')
Ejemplo n.º 2
0
def show(request):
	tournament = Tournament.get()
	return render(request, 'tournaments/show.html', {'tournament':tournament})