예제 #1
0
파일: views.py 프로젝트: yankaics/acm2015
def set_concern_teams(request):
    generator = BoardGenerator()
    problems = generator.get_problems()
    standing = generator.make_board()
    if request.method == "POST":
        request.session["concern"] = request.POST.getlist("concern_list")
        return show_concerned_ranklist(request)
    if "concern" not in request.session:
        request.session["concern"] = []
    for st in standing:
        if unicode(st["teamId"]) in request.session["concern"]:
            st["concern"] = True
    return render_to_response("ranklist_concern.html", locals(), context_instance=RequestContext(request))
예제 #2
0
def set_concern_teams(request):
    generator = BoardGenerator()
    problems = generator.get_problems()
    standing = generator.make_board()
    if request.method == 'POST':
        request.session['concern'] = request.POST.getlist('concern_list')
        return show_concerned_ranklist(request)
    if 'concern' not in request.session:
        request.session['concern'] = []
    for st in standing:
        if unicode(st['teamId']) in request.session['concern']:
            st['concern'] = True
    return render_to_response('ranklist_concern.html',
                              locals(),
                              context_instance=RequestContext(request))
예제 #3
0
파일: views.py 프로젝트: yankaics/acm2015
def show_ranklist(request, is_concern=False, is_display=False):
    generator = BoardGenerator()
    header = generator.get_header()
    problems = generator.get_problems()
    for pb in problems:
        pb["id"] = chr(pb["id"] + ord("A") - 1)
    board = generator.make_board()
    if is_concern:
        standing = []
        for bd in board:
            if unicode(bd["teamId"]) in request.session["concern"]:
                standing.append(bd)
    else:
        standing = board
    if is_display:
        return render_to_response("ranklist_display.html", locals(), context_instance=RequestContext(request))
    else:
        return render_to_response("ranklist_show.html", locals(), context_instance=RequestContext(request))
예제 #4
0
def show_ranklist(request, is_concern=False, is_display=False):
    generator = BoardGenerator()
    header = generator.get_header()
    problems = generator.get_problems()
    for pb in problems:
        pb['id'] = chr(pb['id'] + ord('A') - 1)
    board = generator.make_board()
    if is_concern:
        standing = []
        for bd in board:
            if unicode(bd['teamId']) in request.session['concern']:
                standing.append(bd)
    else:
        standing = board
    if is_display:
        return render_to_response('ranklist_display.html',
                                  locals(),
                                  context_instance=RequestContext(request))
    else:
        return render_to_response('ranklist_show.html',
                                  locals(),
                                  context_instance=RequestContext(request))