Beispiel #1
0
def statements(request, id):
    problem = get_object_or_404(Problem, id=id)
    error = None
    if request.method == 'POST' and 'save_and_generate' in request.POST:
        materials.edit_dict(request, id)
        try:
            materials.gen_statement(request, id)
        except PleaseException as e:
            error = str(e)
    return render_to_response(
        'problem/statements.html', {
            'nav':
            'statements',
            'problem':
            problem,
            'edit_dict':
            materials.edit_dict(request, id),
            'todo':
            todo.show_block(problem),
            'files_in_dir':
            manage_tests.files_in_dir_block(problem),
            'error':
            error,
            'pdf_exists':
            os.path.isfile(
                os.path.join(
                    problem.path, globalconfig.statements_dir,
                    os.path.splitext(os.path.basename(
                        problem.statement_path))[0] + ".pdf"))
        }, RequestContext(request))
Beispiel #2
0
def show_test(request, id, solution_name, test_id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response('problem/test.html', {
        'problem': problem,
        'todo': todo.show_block(problem),
        'files_in_dir': manage_tests.files_in_dir_block(problem),
        'test': tests_page.single_test_block(problem, solution_name, test_id),
    }, RequestContext(request))
Beispiel #3
0
def solutions(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response('problem/solutions.html', {
        'nav': 'solutions',
        'problem': problem,
        'upload_solution': upload_solution(request, id),
        'retest': retest_solutions(request, id),
        'todo': todo.show_block(problem),
        'files_in_dir': manage_tests.files_in_dir_block(problem),
    }, RequestContext(request))
Beispiel #4
0
def settings(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response('problem/settings.html', {
        'nav': 'settings',
        'problem': problem,
        'edit_problem': edit_or_create_problem_block(request, problem),
        'edit_tags': process_edit_tags(request, id),
        'todo': todo.show_block(problem),
        'files_in_dir': manage_tests.files_in_dir_block(problem),
    }, RequestContext(request))
Beispiel #5
0
def show_test(request, id, solution_name, test_id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response(
        'problem/test.html', {
            'problem': problem,
            'todo': todo.show_block(problem),
            'files_in_dir': manage_tests.files_in_dir_block(problem),
            'test': tests_page.single_test_block(problem, solution_name,
                                                 test_id),
        }, RequestContext(request))
Beispiel #6
0
def tests(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response('problem/tests.html', {
        'nav': 'tests',
        'problem': problem,
        'manage_tests': manage_tests.manage_tests(request, problem),
        'test_data': show_tests_block(request, problem),
        'upload_main': files.upload_main_block(request, problem),
        'todo': todo.show_block(problem),
        'files_in_dir': manage_tests.files_in_dir_block(problem),
    }, RequestContext(request))
Beispiel #7
0
def solutions(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response(
        'problem/solutions.html', {
            'nav': 'solutions',
            'problem': problem,
            'upload_solution': upload_solution(request, id),
            'retest': retest_solutions(request, id),
            'todo': todo.show_block(problem),
            'files_in_dir': manage_tests.files_in_dir_block(problem),
        }, RequestContext(request))
Beispiel #8
0
def settings(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response(
        'problem/settings.html', {
            'nav': 'settings',
            'problem': problem,
            'edit_problem': edit_or_create_problem_block(request, problem),
            'edit_tags': process_edit_tags(request, id),
            'todo': todo.show_block(problem),
            'files_in_dir': manage_tests.files_in_dir_block(problem),
        }, RequestContext(request))
Beispiel #9
0
def tests(request, id):
    problem = get_object_or_404(Problem, id=id)
    return render_to_response(
        'problem/tests.html', {
            'nav': 'tests',
            'problem': problem,
            'manage_tests': manage_tests.manage_tests(request, problem),
            'test_data': show_tests_block(request, problem),
            'upload_main': files.upload_main_block(request, problem),
            'todo': todo.show_block(problem),
            'files_in_dir': manage_tests.files_in_dir_block(problem),
        }, RequestContext(request))
Beispiel #10
0
def statements(request, id):
    problem = get_object_or_404(Problem, id=id)
    error = None
    if request.method == 'POST' and 'save_and_generate' in request.POST:
        materials.edit_dict(request, id)
        try:
            materials.gen_statement(request, id)
        except PleaseException as e:
            error = str(e)
    return render_to_response('problem/statements.html', {
        'nav': 'statements',
        'problem': problem,
        'edit_dict': materials.edit_dict(request, id),
        'todo': todo.show_block(problem),
        'files_in_dir': manage_tests.files_in_dir_block(problem),
        'error': error,
        'pdf_exists': os.path.isfile(os.path.join(
            problem.path,
            globalconfig.statements_dir,
            os.path.splitext(os.path.basename(problem.statement_path))[0] + ".pdf"))
    }, RequestContext(request))