A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
add option for inline vs. attachment for document rendering
Joshua Taillon22378789e2a1
diff --git a/paperless.conf.example b/paperless.conf.exampleindex d47e4d453..996b816f8 100644--- a/paperless.conf.example+++ b/paperless.conf.example@@ -117,6 +117,10 @@ PAPERLESS_EMAIL_SECRET=""# http://paperless.readthedocs.org/en/latest/consumption.html#hooking-into-the-consumption-process#PAPERLESS_POST_CONSUME_SCRIPT="/path/to/an/arbitrary/script.sh"+# By default, when clicking on a document within the web interface, the+# browser will prompt the user to save the document to disk. By uncommenting+# the below, the document will instead be opened in the browser, if possible.+#PAPERLESS_INLINE_DOC="true"## The following values use sensible defaults for modern systems, but if you'rediff --git a/src/documents/views.py b/src/documents/views.pyindex e297e0984..4f71deb56 100644--- a/src/documents/views.py+++ b/src/documents/views.py@@ -1,6 +1,8 @@from django.http import HttpResponse, HttpResponseBadRequestfrom django.views.generic import DetailView, FormView, TemplateViewfrom django_filters.rest_framework import DjangoFilterBackend+from django.conf import settings+from paperless.db import GnuPGfrom paperless.mixins import SessionOrBasicAuthMixinfrom paperless.views import StandardPagination@@ -60,8 +62,12 @@ class FetchView(SessionOrBasicAuthMixin, DetailView):self._get_raw_data(self.object.source_file),content_type=content_types[self.object.file_type])- response["Content-Disposition"] = 'attachment; filename="{}"'.format(- self.object.file_name)++ print("OPEN_DOCUMENT", settings.INLINE_DOC)+ DISPOSITION = 'inline' if settings.INLINE_DOC else 'attachment'++ response["Content-Disposition"] = '{}; filename="{}"'.format(+ DISPOSITION, self.object.file_name)return response