def view_duplicate_benchmark_definition(request, benchmark_definition_id):
    """ Duplicate benchmark definition properties """
    if request.method != 'POST':
        return res.get_only_post_allowed({})

    dup_bench_entry = BenchmarkDefinitionController.duplicate_benchmark_definition(
        benchmark_definition_id)

    if dup_bench_entry is None:
        return res.get_response(404, 'Benchmark Defintion save error', {})

    data = {}
    data['redirect'] = ViewUrlGenerator.get_benchmark_definition_url(
        dup_bench_entry.id)

    return res.get_response(200, 'Benchmark Definition saved', data)
def get_benchmark_definition_all(request, page_index):
    """ Returns html for the benchmark definition page """

    (definitions, page_indices) = BenchmarkDefinitionController.get_benchmark_definitions_with_pagination(
        DEFINITION_ITEMS_PER_PAGE,
        page_index,
        PAGINATION_HALF_RANGE
    )

    for definition in definitions:
        definition['url'] = {}
        definition['url']['single'] = ViewUrlGenerator.get_benchmark_definition_url(definition['id'])

    data = {}
    data['definitions'] = definitions
    data['menu'] = ViewPrepareObjects.prepare_menu_for_html([])
    data['pagination'] = ViewPrepareObjects.prepare_pagination_bench_definitions(page_indices)
    data['controls'] = get_definition_controls()
    return res.get_template_data(request, 'presenter/benchmark_definition_all.html', data)