From 925f4adeac61675e60caec6e1bee1bbce3d67087 Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 12 Dec 2020 11:27:26 +0000 Subject: [PATCH] add images to question list viewer --- anatomy/static/css/anatomy.css | 5 +++++ anatomy/tables.py | 13 ++++++++++++- anatomy/templates/anatomy/exam_scores_user.html | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/anatomy/static/css/anatomy.css b/anatomy/static/css/anatomy.css index 65b6f988..747ef2c4 100644 --- a/anatomy/static/css/anatomy.css +++ b/anatomy/static/css/anatomy.css @@ -294,6 +294,11 @@ img.uploading:hover { color: green; } +.user-answer-score pre { + display: inline; + color: inherit; +} + .correct-answer { color: white; } diff --git a/anatomy/tables.py b/anatomy/tables.py index 2a262ab4..be739ed3 100644 --- a/anatomy/tables.py +++ b/anatomy/tables.py @@ -3,6 +3,16 @@ from django_tables2.utils import A from .models import AnatomyQuestion +from django.utils.html import format_html + +from easy_thumbnails.files import get_thumbnailer + +class ImageColumn(tables.Column): + def render(self, value): + thumbnailer = get_thumbnailer(value) + return format_html('', thumbnailer["exam-list"]) + + class AnatomyQuestionTable(tables.Table): edit = tables.LinkColumn('anatomy:anatomy_question_update', @@ -13,6 +23,7 @@ class AnatomyQuestionTable(tables.Table): text='View', args=[A('pk')], orderable=False) + image = ImageColumn("image", orderable=False) #clone = tables.LinkColumn('anatomy:anatomy_question_clone', # text='Clone', # args=[A('pk')], @@ -23,4 +34,4 @@ class AnatomyQuestionTable(tables.Table): template_name = "django_tables2/bootstrap4.html" fields = ("question_type", "exams", "description", "examination", "modality", "region", "body_part", "created_date", "open_access", "author") - sequence = ("view", ) \ No newline at end of file + sequence = ("view", "image") \ No newline at end of file diff --git a/anatomy/templates/anatomy/exam_scores_user.html b/anatomy/templates/anatomy/exam_scores_user.html index cc51542d..0a5931ca 100644 --- a/anatomy/templates/anatomy/exam_scores_user.html +++ b/anatomy/templates/anatomy/exam_scores_user.html @@ -7,7 +7,7 @@ Answers:
Total mark: {{ total_score }} / {{max_score}}