This commit is contained in:
Ross
2021-02-06 21:48:04 +00:00
parent 6098e636c8
commit e0b73c70f5
12 changed files with 194 additions and 62 deletions
+13 -6
View File
@@ -1,7 +1,7 @@
import django_tables2 as tables
from django_tables2.utils import A
from .models import Long
from .models import Long, LongSeries
from django.utils.html import format_html
@@ -67,6 +67,10 @@ class PopupLinkColumn(tables.Column):
return obj.get_thumbnail()[0]
def create_link(test):
print(test)
return "Hello"
class LongSeriesTable(tables.Table):
edit = tables.LinkColumn(
"longs:long_series_update", text="Edit", args=[A("pk")], orderable=False
@@ -74,13 +78,16 @@ 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
)
popup = tables.Column(empty_values=(), orderable=False)
images = LongSeriesImageColumn("Images", orderable=False)
class Meta:
model = Long
model = LongSeries
template_name = "django_tables2/bootstrap4.html"
fields = ("modality", "examination", "long", "description", "author")
sequence = ("view", "popup", "images")
sequence = ("view", "popup", "images")
def render_popup(self, value, record):
print(self)
return format_html("""<a href="#" onclick="return window.create_popup_window('/longs/series/{}', 'Series')" >Popup</a>""", record.pk)