def result_details(request, context):
    quiz = context['object']
    if not quiz.has_correct_answers:
        raise Http404
    results = request.GET.get(RESULT_FIELD, '').split('|')
    if len(results) != len(quiz.questions):
        raise Http404

    questions = []
    for question, q_res in zip(quiz.questions, results):
        q_id, id_list = q_res.split(':')
        choices = question.choices
        if question.allow_multiple:
            cl = set(id_list.split(','))
            for ch in choices:
                if str(ch.id) in cl:
                    ch.chosen = True
        else:
            for ch in choices:
                if str(ch.id) == id_list:
                    ch.chosen = True
                    break
        questions.append((question, choices))

    context['questions'] = questions

    return render_to_response(
            get_templates_from_publishable('result_detail.html', context['object']),
            context,
            context_instance=RequestContext(request)
        )