Beispiel #1
0
def index(request):
    """
    Renders the search page according to the index.html template, with a
    form.SearchForm as the search form.

    If the search form has any GET data, builds the appropriate context dict
    for the render from the request using an QueryRequestHandler

    :param request:
    :return:
    """
    template = 'experimentsearch/index.html'
    if request.method == 'GET':
        index_helper = QueryRequestHandler(request, testing=testing)
        context = index_helper.handle_request()
        #  if request was from a redirect from a download preparation page
        download = csv_response is not None
        context.update({'download': download})
        return render(request, template, context)
    else:
        return render(
            request, template,
            {'search_form': my_forms.NameSearchForm(),
             'search_select': my_forms.SearchTypeSelect()}
        )