diff --git a/rapids/tables.py b/rapids/tables.py
index a11c49ce..aa2de77f 100755
--- a/rapids/tables.py
+++ b/rapids/tables.py
@@ -3,6 +3,21 @@ from django_tables2.utils import A
from .models import Rapid
+from django.utils.html import format_html
+
+from easy_thumbnails.files import get_thumbnailer
+
+from easy_thumbnails.exceptions import InvalidImageFormatError
+
+
+class ImageColumn(tables.Column):
+ def render(self, value):
+ try:
+ thumbnailer = get_thumbnailer(value)
+ return format_html(' Images:
{% for image in rapid.images.all %}
Image {{ forloop.counter }}{% if image.feedback_image %} [feedback image]{% endif %}:
- ', thumbnailer["exam-list"])
+ except InvalidImageFormatError:
+ return format_html('Invalid image url', value)
+
class RapidTable(tables.Table):
edit = tables.LinkColumn('rapids:rapid_update',
@@ -17,10 +32,11 @@ class RapidTable(tables.Table):
text='Clone',
args=[A('pk')],
orderable=False)
+ image = ImageColumn("image", orderable=False)
class Meta:
model = Rapid
template_name = "django_tables2/bootstrap4.html"
fields = ("normal", "abnormality", "region", "examination",
"laterality", "site", "created_date", "author")
- sequence = ("view", )
\ No newline at end of file
+ sequence = ("view", "image")
\ No newline at end of file
diff --git a/rapids/templates/rapids/rapid_display_block.html b/rapids/templates/rapids/rapid_display_block.html
index 054020a1..1b39cd60 100755
--- a/rapids/templates/rapids/rapid_display_block.html
+++ b/rapids/templates/rapids/rapid_display_block.html
@@ -11,8 +11,8 @@
-
Feedback: {{ rapid.feedback }}