.
This commit is contained in:
+13
-1
@@ -57,6 +57,15 @@ class LongTable(tables.Table):
|
|||||||
fields = ("examination", "created_date", "author")
|
fields = ("examination", "created_date", "author")
|
||||||
sequence = ("view", "series")
|
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):
|
class LongSeriesTable(tables.Table):
|
||||||
edit = tables.LinkColumn(
|
edit = tables.LinkColumn(
|
||||||
@@ -65,10 +74,13 @@ class LongSeriesTable(tables.Table):
|
|||||||
view = tables.LinkColumn(
|
view = tables.LinkColumn(
|
||||||
"longs:long_series_detail", text="View", args=[A("pk")], orderable=False
|
"longs:long_series_detail", text="View", args=[A("pk")], orderable=False
|
||||||
)
|
)
|
||||||
|
popup = PopupLinkColumn(
|
||||||
|
"View in popup", orderable=False
|
||||||
|
)
|
||||||
images = LongSeriesImageColumn("Images", orderable=False)
|
images = LongSeriesImageColumn("Images", orderable=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Long
|
model = Long
|
||||||
template_name = "django_tables2/bootstrap4.html"
|
template_name = "django_tables2/bootstrap4.html"
|
||||||
fields = ("modality", "examination", "long", "description", "author")
|
fields = ("modality", "examination", "long", "description", "author")
|
||||||
sequence = ("view", "images")
|
sequence = ("view", "popup", "images")
|
||||||
@@ -26,15 +26,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% 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 %}
|
{% endblock %}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
{{series.get_block}}
|
{{series.get_block}}
|
||||||
</a>
|
</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>
|
>Popup</a>
|
||||||
</span>
|
</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user