try adding series data to case table
This commit is contained in:
+13
-8
@@ -27,6 +27,19 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
|
||||
class CaseTable(tables.Table):
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"author", # Many-to-many or reverse relationship
|
||||
"series", # Many-to-many relationship
|
||||
"series__examination", # ForeignKey in the related model
|
||||
"series__plane", # ForeignKey in the related model
|
||||
"series__images", # Reverse relationship
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def get_view_cell(record):
|
||||
if record.open_access:
|
||||
return format_html(f"""<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-opencollective" viewBox="0 0 16 16">
|
||||
@@ -68,14 +81,6 @@ class CaseTable(tables.Table):
|
||||
sequence = ("view", )#, "series")
|
||||
order_by = "-created_date"
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"author", "series",#"condition", "condition__synonym"
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
class PopupLinkColumn(tables.Column):
|
||||
def render(self, value):
|
||||
|
||||
Reference in New Issue
Block a user