From 40f71ba5f11d22a790ae01ee72b6686cf858fdc8 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Mon, 12 Sep 2016 21:32:44 +0100 Subject: [PATCH] Use djangos fileresponse --- project/files/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/files/views.py b/project/files/views.py index eca7796..50b8f3c 100644 --- a/project/files/views.py +++ b/project/files/views.py @@ -1,6 +1,6 @@ from django.views.generic import TemplateView from django.shortcuts import get_object_or_404 -from django.http import HttpResponse +from django.http import FileResponse as BaseFileResponse from .models import SharedFile, FileToken import mimetypes from django.utils import timezone @@ -21,7 +21,7 @@ class SharedFileDetails(TemplateView): def FileResponse(file): - response = HttpResponse(file.file) + response = BaseFileResponse(file.file) response['Content-Type'] = mimetypes.guess_type(file.get_original_filename())[0] response['Content-Disposition'] = 'attachment; filename="{0}"'.format(file.get_original_filename()) return response