Add Resource filtering and table display functionality

This commit is contained in:
Ross
2025-11-14 20:56:49 +00:00
parent 453fbf91be
commit ca2b7feb5b
4 changed files with 49 additions and 9 deletions
+13
View File
@@ -14,6 +14,7 @@ from .models import (
Structure,
Finding,
Subspecialty,
Resource,
)
from django.utils.html import format_html
@@ -414,6 +415,18 @@ class SubspecialtyTable(SelectionTable):
return format_html(record.get_synonym_link())
return f"{record.get_synonym_link()}"
class ResourceTable(SelectionTable):
name = tables.Column(linkify=("atlas:resource_detail", {"pk": tables.A("pk")}), verbose_name="Resource")
edit = tables.LinkColumn("atlas:resource_update", text="Edit", args=[A("pk")], orderable=False)
delete = tables.LinkColumn("atlas:resource_delete", text="Delete", args=[A("pk")], orderable=False)
class Meta(SelectionTable.Meta):
model = Resource
template_name = "django_tables2/bootstrap4.html"
fields = ("name", "description")
class CaseCollectionTable(SelectionTable):
edit = tables.LinkColumn(
"atlas:exam_update", text="Edit", args=[A("pk")], orderable=False