The first stages of getting thumbnails back

This commit is contained in:
Daniel Quinn
2016-03-05 01:57:49 +00:00
parent 5c41e717f0
commit 52f15b4de1
7 changed files with 135 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ class FetchView(LoginRequiredMixin, DetailView):
def render_to_response(self, context, **response_kwargs):
"""
Override the default to return the unencrypted PDF as raw data.
Override the default to return the unencrypted image/PDF as raw data.
"""
content_types = {
@@ -46,6 +46,12 @@ class FetchView(LoginRequiredMixin, DetailView):
Document.TYPE_TIF: "image/tiff",
}
if self.kwargs["kind"] == "thumb":
return HttpResponse(
GnuPG.decrypted(self.object.thumb_file),
content_type=content_types[Document.TYPE_JPG]
)
response = HttpResponse(
GnuPG.decrypted(self.object.source_file),
content_type=content_types[self.object.file_type]