Beispiel #1
0
def export_contributor_results(contributor):
    filename = "Evaluation_{}.xls".format(contributor.full_name)
    response = FileResponse(filename, content_type="application/vnd.ms-excel")
    ExcelExporter().export(response,
                           Semester.objects.all(),
                           [(Degree.objects.all(), CourseType.objects.all())],
                           include_not_enough_voters=True,
                           include_unpublished=False,
                           contributor=contributor)
    return response
Beispiel #2
0
def reward_point_redemption_event_export(request, event_id):
    event = get_object_or_404(RewardPointRedemptionEvent, id=event_id)

    filename = _("RewardPoints") + "-%s-%s-%s.xls" % (event.date, event.name,
                                                      get_language())
    response = FileResponse(filename, content_type="application/vnd.ms-excel")

    RewardsExporter().export(response, event.redemptions_by_user())

    return response
Beispiel #3
0
def evaluation_text_answers_export(request, evaluation_id):
    evaluation = get_object_or_404(Evaluation, id=evaluation_id)

    results, contributor_id = extract_evaluation_answer_data(request, evaluation)
    contributor_name = UserProfile.objects.get(id=contributor_id).full_name if contributor_id is not None else None

    filename = "Evaluation-Text-Answers-{}-{}-{}.xls".format(
        evaluation.course.semester.short_name,
        evaluation.full_name,
        translation.get_language()
    )

    response = FileResponse(filename, content_type="application/vnd.ms-excel")

    TextAnswerExporter(evaluation.full_name, evaluation.course.semester.name,
                            evaluation.course.responsibles_names, results, contributor_name).export(response)

    return response