.
This commit is contained in:
+5
-4
@@ -12,11 +12,12 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
class ImageColumn(tables.Column):
|
||||
def render(self, value):
|
||||
image_object = value.first().image
|
||||
try:
|
||||
thumbnailer = get_thumbnailer(value)
|
||||
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>', value)
|
||||
return format_html('<span title="{}">Invalid image url<span>', image_object)
|
||||
|
||||
|
||||
class RapidTable(tables.Table):
|
||||
@@ -32,11 +33,11 @@ class RapidTable(tables.Table):
|
||||
text='Clone',
|
||||
args=[A('pk')],
|
||||
orderable=False)
|
||||
image = ImageColumn("image", orderable=False)
|
||||
images = ImageColumn("images", orderable=False)
|
||||
|
||||
class Meta:
|
||||
model = Rapid
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("normal", "abnormality", "region", "examination",
|
||||
"laterality", "site", "created_date", "author")
|
||||
sequence = ("view", "image")
|
||||
sequence = ("view", "images")
|
||||
Reference in New Issue
Block a user