From ad778a6308960c73e558058f8368818a839b6067 Mon Sep 17 00:00:00 2001 From: Ross Date: Thu, 25 Nov 2021 17:54:19 +0000 Subject: [PATCH] . --- atlas/tables.py | 32 +++++++++++++++++++------- atlas/templates/atlas/case_detail.html | 25 +++++++++++--------- atlas/urls.py | 4 ++-- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/atlas/tables.py b/atlas/tables.py index daf42c16..d28c7050 100755 --- a/atlas/tables.py +++ b/atlas/tables.py @@ -12,10 +12,12 @@ from easy_thumbnails.exceptions import InvalidImageFormatError class AtlasImageColumn(tables.Column): def render(self, value): - blocks =[] + blocks = [] for obj in value.all(): blocks.append(obj.get_block()) - return format_html("{}".format("".join(blocks))) + return format_html( + "{}".format("".join(blocks)) + ) obj = value.first() @@ -42,14 +44,22 @@ class SeriesImageColumn(tables.Column): image_object = obj.image try: thumbnailer = get_thumbnailer(image_object) - return format_html('
[{}]', thumbnailer["exam-list"], value.count()) + return format_html( + '
[{}]', + thumbnailer["exam-list"], + value.count(), + ) except InvalidImageFormatError: - return format_html('Invalid image url
[{}]', image_object, value.count()) + return format_html( + 'Invalid image url
[{}]', + image_object, + value.count(), + ) class AtlasTable(tables.Table): edit = tables.LinkColumn( - "atlas:atlas_update", text="Edit", args=[A("pk")], orderable=False + "atlas:case_update", text="Edit", args=[A("pk")], orderable=False ) view = tables.LinkColumn( "atlas:case_detail", text="View", args=[A("pk")], orderable=False @@ -58,11 +68,11 @@ class AtlasTable(tables.Table): "atlas:case_clone", text="Clone", args=[A("pk")], orderable=False ) delete = tables.LinkColumn( - "atlas:atlas_delete", text="Delete", args=[A("pk")], orderable=False + "atlas:case_delete", text="Delete", args=[A("pk")], orderable=False ) series = AtlasImageColumn("Images", orderable=False) - #series = tables.ManyToManyColumn(verbose_name="Exams") + # series = tables.ManyToManyColumn(verbose_name="Exams") exams = tables.ManyToManyColumn(verbose_name="Exams") selection = tables.CheckBoxColumn(accessor="pk", orderable=False) @@ -73,6 +83,7 @@ class AtlasTable(tables.Table): fields = ("description", "history", "created_date", "author") sequence = ("view", "series", "exams") + class PopupLinkColumn(tables.Column): def render(self, value): return format_html("test: {}", value) @@ -83,10 +94,12 @@ class PopupLinkColumn(tables.Column): return obj.get_thumbnail()[0] + def create_link(test): print(test) return "Hello" + class SeriesTable(tables.Table): edit = tables.LinkColumn( "atlas:series_update", text="Edit", args=[A("pk")], orderable=False @@ -111,4 +124,7 @@ class SeriesTable(tables.Table): def render_popup(self, value, record): print(self) - return format_html("""Popup""", record.pk) \ No newline at end of file + return format_html( + """Popup""", + record.pk, + ) diff --git a/atlas/templates/atlas/case_detail.html b/atlas/templates/atlas/case_detail.html index 2288a517..5722afb3 100755 --- a/atlas/templates/atlas/case_detail.html +++ b/atlas/templates/atlas/case_detail.html @@ -5,16 +5,19 @@
-Edit -Clone -Delete - Add Note -{% if request.user.is_superuser %} -Admin Edit -{% endif %} -{% include 'atlas/atlas_display_block.html' %} -{% endblock %} + Edit + Clone + Delete + Add + Note + {% if request.user.is_superuser %} + Admin Edit + {% endif %} + {% include 'atlas/atlas_display_block.html' %} + {% endblock %} -{% block js %} + {% block js %} -{% endblock %} \ No newline at end of file + {% endblock %} \ No newline at end of file diff --git a/atlas/urls.py b/atlas/urls.py index c6547b28..b916545a 100755 --- a/atlas/urls.py +++ b/atlas/urls.py @@ -47,7 +47,7 @@ urlpatterns = [ # path("verified/", views.verified, name="verified"), # path("all_questions/", views.all_questions, name="all_questions"), path("question//scrap", views.atlas_scrap, name="atlas_scrap"), - path("question//delete", views.AtlasDelete.as_view(), name="atlas_delete"), + path("question//delete", views.AtlasDelete.as_view(), name="case_delete"), path("create/", views.AtlasCreate.as_view(), name="create"), path("create/series", views.SeriesCreate.as_view(), name="series_create"), path( @@ -64,7 +64,7 @@ urlpatterns = [ path( "question//update", views.AtlasUpdate.as_view(), - name="atlas_update", + name="case_update", ), path( "series//update",