Add PDF preview next to edit form

This commit is contained in:
Johann Bauer
2020-01-04 00:33:24 +01:00
parent 5317019d71
commit a4573a8de8
3 changed files with 40 additions and 2 deletions

View File

@@ -69,7 +69,10 @@ class FetchView(SessionOrBasicAuthMixin, DetailView):
content_type=content_types[self.object.file_type]
)
DISPOSITION = 'inline' if settings.INLINE_DOC else 'attachment'
DISPOSITION = (
'inline' if settings.INLINE_DOC or self.kwargs["kind"] == 'preview'
else 'attachment'
)
response["Content-Disposition"] = '{}; filename="{}"'.format(
DISPOSITION, self.object.file_name)