This commit is contained in:
Ross
2021-02-06 14:55:41 +00:00
parent 54678bfc86
commit 6098e636c8
3 changed files with 14 additions and 12 deletions
+13 -1
View File
@@ -57,6 +57,15 @@ class LongTable(tables.Table):
fields = ("examination", "created_date", "author")
sequence = ("view", "series")
class PopupLinkColumn(tables.Column):
def render(self, value):
return format_html("<span>test: {}<span>", value)
obj = value.first()
if obj is None:
return format_html("<span>No image<span>")
return obj.get_thumbnail()[0]
class LongSeriesTable(tables.Table):
edit = tables.LinkColumn(
@@ -65,10 +74,13 @@ class LongSeriesTable(tables.Table):
view = tables.LinkColumn(
"longs:long_series_detail", text="View", args=[A("pk")], orderable=False
)
popup = PopupLinkColumn(
"View in popup", orderable=False
)
images = LongSeriesImageColumn("Images", orderable=False)
class Meta:
model = Long
template_name = "django_tables2/bootstrap4.html"
fields = ("modality", "examination", "long", "description", "author")
sequence = ("view", "images")
sequence = ("view", "popup", "images")