mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-11 10:00:48 -05:00
Add document thumbnail images; use django-suit theme for admin
This commit is contained in:
parent
1711030cb5
commit
bee0867a2a
@ -3,6 +3,7 @@ Pillow>=3.1.1
|
|||||||
django-crispy-forms>=1.6.0
|
django-crispy-forms>=1.6.0
|
||||||
django-extensions>=1.6.1
|
django-extensions>=1.6.1
|
||||||
django-filter>=1.0
|
django-filter>=1.0
|
||||||
|
django-suit>=0.2.23
|
||||||
djangorestframework>=3.4.4
|
djangorestframework>=3.4.4
|
||||||
filemagic>=1.6
|
filemagic>=1.6
|
||||||
langdetect>=1.0.5
|
langdetect>=1.0.5
|
||||||
|
@ -53,13 +53,24 @@ class DocumentAdmin(admin.ModelAdmin):
|
|||||||
}
|
}
|
||||||
|
|
||||||
search_fields = ("correspondent__name", "title", "content")
|
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_filter = ("tags", "correspondent", MonthListFilter)
|
||||||
|
ordering = ["-created", "correspondent"]
|
||||||
list_per_page = 25
|
list_per_page = 25
|
||||||
|
|
||||||
def created_(self, obj):
|
def created_(self, obj):
|
||||||
return obj.created.date().strftime("%Y-%m-%d")
|
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):
|
def tags_(self, obj):
|
||||||
r = ""
|
r = ""
|
||||||
for tag in obj.tags.all():
|
for tag in obj.tags.all():
|
||||||
|
@ -44,6 +44,7 @@ if os.path.exists("/etc/paperless.conf"):
|
|||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
|
||||||
|
'suit',
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
'django.contrib.auth',
|
'django.contrib.auth',
|
||||||
'django.contrib.contenttypes',
|
'django.contrib.contenttypes',
|
||||||
@ -60,6 +61,21 @@ INSTALLED_APPS = [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
SUIT_CONFIG = {
|
||||||
|
'ADMIN_NAME': 'Paperless',
|
||||||
|
'SEARCH_URL': '',
|
||||||
|
'LIST_PER_PAGE': 100,
|
||||||
|
'HEADER_DATE_FORMAT': 'D m-d-Y',
|
||||||
|
'MENU': (
|
||||||
|
'sites',
|
||||||
|
{ 'app': 'documents',
|
||||||
|
'label': 'Paperless',
|
||||||
|
'icon': 'icon-file',
|
||||||
|
'models': ('Document', 'Tag', 'Correspondent', 'log')
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = [
|
MIDDLEWARE_CLASSES = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user