diff --git a/paperless.conf.example b/paperless.conf.example index 3fb6ceb4b..0d82dd7ef 100644 --- a/paperless.conf.example +++ b/paperless.conf.example @@ -102,3 +102,13 @@ PAPERLESS_SHARED_SECRET="" # as is "example.com,www.example.com", but NOT " example.com" or "example.com," #PAPERLESS_ALLOWED_HOSTS="example.com,www.example.com" +# Override the default UTC time zone here +#PAPERLESS_TIME_ZONE=UTC + +# Customize number of list items to show per page +#PAPERLESS_LIST_PER_PAGE=50 + +# Customize the default language that tesseract will attempt to use when parsing +# documents. It should be a 3-letter language code consistent with ISO 639. +#PAPERLESS_OCR_LANGUAGE=eng + diff --git a/requirements.txt b/requirements.txt index 193a6d063..68ffdc2c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ Pillow>=3.1.1 django-crispy-forms>=1.6.0 django-extensions>=1.6.1 django-filter>=1.0 +django-suit>=0.2.23 djangorestframework>=3.4.4 filemagic>=1.6 langdetect>=1.0.5 diff --git a/src/documents/admin.py b/src/documents/admin.py index 4e81f7916..d59cec0bd 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -53,13 +53,23 @@ class DocumentAdmin(admin.ModelAdmin): } search_fields = ("correspondent__name", "title", "content") - list_display = ("created", "correspondent", "title", "tags_", "document") + list_display = ("created", "title", "thumbnail", "correspondent", "tags_") list_filter = ("tags", "correspondent", MonthListFilter) - list_per_page = 25 + ordering = ["-created", "correspondent"] def created_(self, obj): return obj.created.date().strftime("%Y-%m-%d") + def thumbnail(self, obj): + png_img = self._html_tag( + "img", + src="/fetch/thumb/{}".format(obj.id), + width=275, + alt="thumbnail", + title=obj.file_name) + return self._html_tag("a", png_img, href=obj.download_url) + thumbnail.allow_tags = True + def tags_(self, obj): r = "" for tag in obj.tags.all(): diff --git a/src/paperless/settings.py b/src/paperless/settings.py index fbc45db05..d9352d7bb 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -44,6 +44,7 @@ if os.path.exists("/etc/paperless.conf"): INSTALLED_APPS = [ + 'suit', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -60,6 +61,22 @@ INSTALLED_APPS = [ ] +_list_per_page = int(os.getenv("PAPERLESS_LIST_PER_PAGE", 25)) +SUIT_CONFIG = { + 'ADMIN_NAME': 'Paperless', + 'SEARCH_URL': '', + 'LIST_PER_PAGE': _list_per_page, + 'HEADER_DATE_FORMAT': 'D m-d-Y', + 'MENU': ( + 'sites', + { 'app': 'documents', + 'label': 'Paperless', + 'icon': 'icon-file', + 'models': ('Document', 'Tag', 'Correspondent', 'log') + }, + ) +} + MIDDLEWARE_CLASSES = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -141,7 +158,7 @@ AUTH_PASSWORD_VALIDATORS = [ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = os.getenv("PAPERLESS_TIME_ZONE", "UTC") USE_I18N = True @@ -187,7 +204,7 @@ LOGGING = { # The default language that tesseract will attempt to use when parsing # documents. It should be a 3-letter language code consistent with ISO 639. -OCR_LANGUAGE = "eng" +OCR_LANGUAGE = os.getenv("PAPERLESS_OCR_LANGUAGE", "eng") # The amount of threads to use for OCR OCR_THREADS = os.getenv("PAPERLESS_OCR_THREADS")