def school_report(request, school_id, start, end):
    school = School.objects.get(pk=school_id)
    start_d = dateparse.parse_date(start)
    end_d = dateparse.parse_date(end)

    report_path = "reports/%s/%s_%s_report.pdf" % (
        school.slug, start, end
    )
    full_path = settings.MEDIA_ROOT + '/' + report_path
    full_url = settings.MEDIA_URL + '/' + report_path

    path = ForkRunR(
        school.pk,
        start_d,
        end_d
    )
    dir_name = os.path.dirname(full_path)
    if not os.path.exists(dir_name):
        os.makedirs(dir_name)
    os.rename(path, full_path)

    send_mail(
        "Your report for school %s, date range %s - %s" % (
            school, start, end
        ),
        "You may download it at http://%s/%s" % (
            request.META['HTTP_HOST'], full_url
        ),
        settings.SERVER_EMAIL,
        [request.user.email]
    )

    return HttpResponseRedirect(full_url)