.
This commit is contained in:
+22
-6
@@ -15,7 +15,9 @@ class AtlasImageColumn(tables.Column):
|
||||
blocks = []
|
||||
for obj in value.all():
|
||||
blocks.append(obj.get_block())
|
||||
return format_html("<span class='multi-image-block'>{}</span>".format("".join(blocks)))
|
||||
return format_html(
|
||||
"<span class='multi-image-block'>{}</span>".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('<img src="/media/{}" /><br/>[{}]', thumbnailer["exam-list"], value.count())
|
||||
return format_html(
|
||||
'<img src="/media/{}" /><br/>[{}]',
|
||||
thumbnailer["exam-list"],
|
||||
value.count(),
|
||||
)
|
||||
except InvalidImageFormatError:
|
||||
return format_html('<span title="{}">Invalid image url<span><br/>[{}]', image_object, value.count())
|
||||
return format_html(
|
||||
'<span title="{}">Invalid image url<span><br/>[{}]',
|
||||
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,7 +68,7 @@ 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)
|
||||
|
||||
@@ -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("<span>test: {}<span>", 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("""<a href="#" onclick="return window.create_popup_window('/atlas/series/{}', 'Series')" >Popup</a>""", record.pk)
|
||||
return format_html(
|
||||
"""<a href="#" onclick="return window.create_popup_window('/atlas/series/{}', 'Series')" >Popup</a>""",
|
||||
record.pk,
|
||||
)
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
|
||||
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'atlas:atlas_update' pk=question.pk %}" title="Edit the Case">Edit</a>
|
||||
<a href="{% url 'atlas:atlas_clone' pk=question.pk %}" title="Clone the Case (duplicate everything but the images)">Clone</a>
|
||||
<a href="{% url 'atlas:atlas_delete' pk=question.pk %}" title="Delete the Case">Delete</a>
|
||||
<a href="#" onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=question.pk %}')"> Add Note</a>
|
||||
<a href="{% url 'atlas:case_update' pk=case.pk %}" title="Edit the Case">Edit</a>
|
||||
<a href="{% url 'atlas:case_clone' pk=case.pk %}"
|
||||
title="Clone the Case (duplicate everything but the images)">Clone</a>
|
||||
<a href="{% url 'atlas:case_delete' pk=case.pk %}" title="Delete the Case">Delete</a>
|
||||
<a href="#"
|
||||
onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=case.pk %}')"> Add
|
||||
Note</a>
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:atlas_case_change' question.id %}" title="Edit the Case using the admin interface">Admin Edit</a>
|
||||
<a href="{% url 'admin:atlas_case_change' case.id %}" title="Edit the Case using the admin interface">Admin Edit</a>
|
||||
{% endif %}
|
||||
{% include 'atlas/atlas_display_block.html' %}
|
||||
{% endblock %}
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ urlpatterns = [
|
||||
# path("verified/", views.verified, name="verified"),
|
||||
# path("all_questions/", views.all_questions, name="all_questions"),
|
||||
path("question/<int:pk>/scrap", views.atlas_scrap, name="atlas_scrap"),
|
||||
path("question/<int:pk>/delete", views.AtlasDelete.as_view(), name="atlas_delete"),
|
||||
path("question/<int:pk>/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/<int:pk>/update",
|
||||
views.AtlasUpdate.as_view(),
|
||||
name="atlas_update",
|
||||
name="case_update",
|
||||
),
|
||||
path(
|
||||
"series/<int:pk>/update",
|
||||
|
||||
Reference in New Issue
Block a user