.
This commit is contained in:
+10
-8
@@ -17,12 +17,14 @@ class ImageColumn(tables.Column):
|
||||
if obj is None:
|
||||
return format_html('<span>No image<span>')
|
||||
|
||||
image_object = obj.image
|
||||
try:
|
||||
thumbnailer = get_thumbnailer(image_object)
|
||||
return format_html('<img src="/media/{}" />', thumbnailer["exam-list"])
|
||||
except InvalidImageFormatError:
|
||||
return format_html('<span title="{}">Invalid image url<span>', image_object)
|
||||
return obj.get_thumbnail()[0]
|
||||
|
||||
#image_object = obj.image
|
||||
#try:
|
||||
# thumbnailer = get_thumbnailer(image_object)
|
||||
# return format_html('<img src="/media/{}" />', thumbnailer["exam-list"])
|
||||
#except InvalidImageFormatError:
|
||||
# return format_html('<span title="{}">Invalid image url<span>', image_object)
|
||||
|
||||
|
||||
class LongTable(tables.Table):
|
||||
@@ -38,11 +40,11 @@ class LongTable(tables.Table):
|
||||
text='Clone',
|
||||
args=[A('pk')],
|
||||
orderable=False)
|
||||
images = ImageColumn("images", orderable=False)
|
||||
series = ImageColumn("images", orderable=False)
|
||||
|
||||
class Meta:
|
||||
model = Long
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("normal", "abnormality", "region", "examination",
|
||||
"laterality", "site", "created_date", "author")
|
||||
sequence = ("view", "images")
|
||||
sequence = ("view", "series")
|
||||
Reference in New Issue
Block a user