Added GPG encryption for the PDFs

This commit is contained in:
Daniel Quinn
2016-01-01 16:13:59 +00:00
parent 6956376d71
commit f72c515742
8 changed files with 106 additions and 50 deletions

View File

@@ -1,5 +1,5 @@
from django.conf import settings
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.templatetags.static import static
from .models import Document
@@ -8,27 +8,20 @@ from .models import Document
class DocumentAdmin(admin.ModelAdmin):
search_fields = ("sender", "title", "content",)
list_display = ("edit", "created", "sender", "title", "thumbnail", "pdf")
list_display = ("edit", "created", "sender", "title", "pdf")
list_filter = ("created", "sender")
save_on_top = True
def edit(self, obj):
return '<img src="{}" width="64" height="64" alt="Edit icon" />'.format(
return '<img src="{}" width="22" height="22" alt="Edit icon" />'.format(
static("documents/img/edit.png"))
edit.allow_tags = True
def thumbnail(self, obj):
return '<a href="{media}documents/img/{pk:07}.jpg" target="_blank">' \
'<img src="{media}documents/img/{pk:07}.jpg" width="100" />' \
'</a>'.format(media=settings.MEDIA_URL, pk=obj.pk)
thumbnail.allow_tags = True
def pdf(self, obj):
return '<a href="{}documents/pdf/{:07}.pdf">' \
'<img src="{}" width="64" height="64" alt="PDF icon">' \
return '<a href="{}">' \
'<img src="{}" width="22" height="22" alt="PDF icon">' \
'</a>'.format(
settings.MEDIA_URL,
obj.pk,
reverse("fetch", kwargs={"pk": obj.pk}),
static("documents/img/application-pdf.png")
)
pdf.allow_tags = True