prefetch data in atlas cables
This commit is contained in:
+20
-3
@@ -58,7 +58,7 @@ class CaseTable(tables.Table):
|
|||||||
def __init__(self, data=None, *args, **kwargs):
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
data.prefetch_related(
|
data.prefetch_related(
|
||||||
#"condition", "condition__synonym"
|
"author",#"condition", "condition__synonym"
|
||||||
),
|
),
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
@@ -115,8 +115,16 @@ class SeriesTable(tables.Table):
|
|||||||
)
|
)
|
||||||
sequence = ("view", "popup", "images", "case")
|
sequence = ("view", "popup", "images", "case")
|
||||||
|
|
||||||
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
|
super().__init__(
|
||||||
|
data.prefetch_related(
|
||||||
|
"modality", "case", "examination", "plane", "contrast", "author", "findings", "images"
|
||||||
|
),
|
||||||
|
*args,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
def render_popup(self, value, record):
|
def render_popup(self, value, record):
|
||||||
print(self)
|
|
||||||
return format_html(
|
return format_html(
|
||||||
"""<a href="#" onclick="return window.create_popup_window('/atlas/series/{}', 'Series')" >Popup</a>""",
|
"""<a href="#" onclick="return window.create_popup_window('/atlas/series/{}', 'Series')" >Popup</a>""",
|
||||||
record.pk,
|
record.pk,
|
||||||
@@ -147,6 +155,15 @@ class ConditionTable(tables.Table):
|
|||||||
fields = ("primary", "subspecialty", "rcr_curriculum_map", "rcr_curriculum")
|
fields = ("primary", "subspecialty", "rcr_curriculum_map", "rcr_curriculum")
|
||||||
sequence = ("name",)
|
sequence = ("name",)
|
||||||
|
|
||||||
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
|
super().__init__(
|
||||||
|
data.prefetch_related(
|
||||||
|
"subspecialty", "rcr_curriculum_map", "parent"
|
||||||
|
),
|
||||||
|
*args,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
def render_synonym(self, value, record):
|
def render_synonym(self, value, record):
|
||||||
return format_html(record.get_synonym_link())
|
return format_html(record.get_synonym_link())
|
||||||
return f"{record.get_synonym_link()}"
|
return f"{record.get_synonym_link()}"
|
||||||
@@ -306,7 +323,7 @@ class CaseCollectionTable(tables.Table):
|
|||||||
def __init__(self, data=None, *args, **kwargs):
|
def __init__(self, data=None, *args, **kwargs):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
data.prefetch_related(
|
data.prefetch_related(
|
||||||
#"condition", "condition__synonym"
|
"author", #"conditionI"", "condition__synonym"
|
||||||
),
|
),
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|||||||
Reference in New Issue
Block a user