예제 #1
0
파일: views.py 프로젝트: bastiao/catalogue
def resultsdiff_historysimple(request, query_id, template_name='history.html'):

    # monkey patch answers into query
    request2 = RequestMonkeyPatch()

    request2.method = request.method
    query = None
    try:
        query = QueryLog.objects.get(id=query_id)
    except:
        print '-- Error: Cant find free text query with id '+str(query_id)
        pass

    # Theres probably a better way to clone and change an httprequest, but i dont know none
    # not could i find them, i needed to create a monkeypatch to send to the results_diff, but this monkey
    # patch had to be like a real httprequest...

    request2.get_post()['query'] = query.query

    request2.set_session(request.session)

    request2.set_user(request.user)

    request2.set_meta(request.META)

    request2.set_cookies(request.COOKIES)

    request2.set_host(request.get_host())

    return results_diff(request2)
예제 #2
0
def resultsdiff_historysimple(request, query_id, template_name='history.html'):

    # monkey patch answers into query
    request2 = RequestMonkeyPatch()

    request2.method = request.method
    query = None
    try:
        query = QueryLog.objects.get(id=query_id)
    except:
        print '-- Error: Cant find free text query with id ' + str(query_id)
        pass

    # Theres probably a better way to clone and change an httprequest, but i dont know none
    # not could i find them, i needed to create a monkeypatch to send to the results_diff, but this monkey
    # patch had to be like a real httprequest...

    request2.get_post()['query'] = query.query

    request2.set_session(request.session)

    request2.set_user(request.user)

    request2.set_meta(request.META)

    request2.set_cookies(request.COOKIES)

    request2.set_host(request.get_host())

    return results_diff(request2)
예제 #3
0
파일: views.py 프로젝트: bastiao/catalogue
def resultsdiff_history(request, query_id, template_name='history.html'):

    # monkey patch answers into query
    request2 = RequestMonkeyPatch()

    request2.method = request.method
    query = None
    try:
        query = AdvancedQuery.objects.get(id=query_id)
    except:
        print '-- Error: Cant find advanced query with id '+str(query_id)
        pass

    this_answers = AdvancedQueryAnswer.objects.filter(refquery=query)

    # Theres probably a better way to clone and change an httprequest, but i dont know none
    # not could i find them, i needed to create a monkeypatch to send to the results_diff, but this monkey
    # patch had to be like a real httprequest...

    request2.get_post()['qid'] = str(query.qid.id)

    request2.get_post()['boolrelwidget-boolean-serialization'] = query.serialized_query

    request2.set_session(request.session)

    request2.set_user(request.user)

    request2.set_meta(request.META)

    request2.set_cookies(request.COOKIES)

    request2.set_host(request.get_host())

    for answer in this_answers:
        request2.get_post()[answer.question] = answer.answer

    return results_diff(request2)
예제 #4
0
def resultsdiff_history(request, query_id, template_name='history.html'):

    # monkey patch answers into query
    request2 = RequestMonkeyPatch()

    request2.method = request.method
    query = None
    try:
        query = AdvancedQuery.objects.get(id=query_id)
    except:
        print '-- Error: Cant find advanced query with id ' + str(query_id)
        pass

    this_answers = AdvancedQueryAnswer.objects.filter(refquery=query)

    # Theres probably a better way to clone and change an httprequest, but i dont know none
    # not could i find them, i needed to create a monkeypatch to send to the results_diff, but this monkey
    # patch had to be like a real httprequest...

    request2.get_post()['qid'] = str(query.qid.id)

    request2.get_post(
    )['boolrelwidget-boolean-serialization'] = query.serialized_query

    request2.set_session(request.session)

    request2.set_user(request.user)

    request2.set_meta(request.META)

    request2.set_cookies(request.COOKIES)

    request2.set_host(request.get_host())

    for answer in this_answers:
        request2.get_post()[answer.question] = answer.answer

    return results_diff(request2)