.
This commit is contained in:
+6
-1
@@ -12,7 +12,12 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
|||||||
|
|
||||||
class ImageColumn(tables.Column):
|
class ImageColumn(tables.Column):
|
||||||
def render(self, value):
|
def render(self, value):
|
||||||
image_object = value.first().image
|
obj = value.first()
|
||||||
|
|
||||||
|
if obj is None:
|
||||||
|
return format_html('<span>No image<span>')
|
||||||
|
|
||||||
|
image_object = obj.image
|
||||||
try:
|
try:
|
||||||
thumbnailer = get_thumbnailer(image_object)
|
thumbnailer = get_thumbnailer(image_object)
|
||||||
return format_html('<img src="/media/{}" />', thumbnailer["exam-list"])
|
return format_html('<img src="/media/{}" />', thumbnailer["exam-list"])
|
||||||
|
|||||||
Reference in New Issue
Block a user