Added a link to the thumbnail

This commit is contained in:
Daniel Quinn 2015-12-21 02:50:33 +00:00
parent 802e9d7045
commit ba01b6abbe

View File

@ -12,8 +12,9 @@ class DocumentAdmin(admin.ModelAdmin):
save_on_top = True save_on_top = True
def thumbnail(self, obj): def thumbnail(self, obj):
return '<img src="{}documents/img/{:07}.jpg" width="100" />'.format( return '<a href="{media}documents/img/{pk:07}.jpg" target="_blank">' \
settings.MEDIA_URL, obj.pk) '<img src="{media}documents/img/{pk:07}.jpg" width="100" />' \
'</a>'.format(media=settings.MEDIA_URL, pk=obj.pk)
thumbnail.allow_tags = True thumbnail.allow_tags = True
def pdf(self, obj): def pdf(self, obj):