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