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")
-10
View File
@@ -26,15 +26,5 @@
{% endblock %}
{% block js %}
<!--<script type="text/javascript" src="/admin/jsi18n/"></script>-->
<script type="text/javascript">
function popitup(url, title) {
newwindow=window.open(url,title,'height=600,width=500');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
{% endblock %}
@@ -13,7 +13,7 @@
{{series.get_block}}
</a>
<a href="#" onclick="return popitup('/longs/series/{{series.pk}}', 'Series')"
<a href="#" onclick="return window.create_popup_window('/longs/series/{{series.pk}}', 'Series')"
>Popup</a>
</span>
{% endfor %}