def tournament_team_browse(request, tournament_id = None, format='html'): tournament = api.tournament_get(tournament_id = tournament_id) all_teams = api.team_browse_rating(tournament_id = tournament_id) area = 'tournament' if format == 'html': return api.response_get(request, locals(), 'tournament/templates/team_browse.html')
def referee_browse(request, tournament_id = None, format='html'): logging.info("Tournament: %s", tournament_id) tournament = api.tournament_get(tournament_id = tournament_id) all_referees = api.referees_browse(tournament_id = tournament_id, stat = True) area = 'referee' if format == 'html': return api.response_get(request, locals(), 'referee/templates/browse.html')
def referee_create(request, format='html'): tournament_id = request.REQUEST.get('tournament_id', '') tournament = api.tournament_get(tournament_id = tournament_id) if request.POST and request.is_owner: item = api.referee_create(request = request) #return http.HttpResponseRedirect("/referee/" + str(item) + "/") #item = request.POST["team_id"] return http.HttpResponseRedirect("/tournament/" + tournament_id + "/referees/") area = 'referee' if format == 'html': return api.response_get(request, locals(), 'referee/templates/create.html')
def tournament_item(request, tournament_id = None, format='html'): #tournament = api.tournament_get(tournament_id) #all_leagues = api.league_browse(tournament_id = tournament_id) tournament = api.tournament_get(tournament_id = tournament_id) defers = { #"tournament": deferred.group(api.tournament_get, tournament_id = tournament_id), #"all_leagues": deferred.group(api.league_browse, tournament_id = tournament_id) } area = 'tournament' is_map = True if format == 'html': return api.response_get(request, locals(), 'tournament/templates/item.html', defers = defers)
def tournament_edit(request, tournament_id = None, format='html'): tournament = api.tournament_get(tournament_id = tournament_id) if not tournament: return http.HttpResponse() if not request.is_owner: return http.HttpResponseRedirect("/tournament/" + tournament_id + "/") if request.method == 'POST': form = models.TournamentFormEdit(request.POST) if form.is_valid(): item = api.tournament_edit(form = form, tournament_id = tournament_id) return http.HttpResponseRedirect("/tournament/" + tournament_id + "/") else: form = models.TournamentFormEdit(tournament) # An unbound form area = 'team' if format == 'html': return api.response_get(request, locals(), 'tournament/templates/edit.html')