.
This commit is contained in:
+20
-1
@@ -1,6 +1,6 @@
|
||||
import django_filters
|
||||
|
||||
from .models import Case, Condition, Finding, PathalogicalProcess, Presentation, Series, Structure
|
||||
from .models import Case, Condition, Finding, PathalogicalProcess, Presentation, Series, Structure, Subspecialty
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
@@ -173,3 +173,22 @@ class PathologicalProcessFilter(django_filters.FilterSet):
|
||||
data=data, queryset=queryset, prefix=prefix, request=request
|
||||
)
|
||||
pass
|
||||
|
||||
class SubspecialtyFilter(django_filters.FilterSet):
|
||||
class Meta:
|
||||
model = Subspecialty
|
||||
fields = ("name")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data=None,
|
||||
queryset=None,
|
||||
prefix=None,
|
||||
strict=None,
|
||||
user=None,
|
||||
request=None,
|
||||
):
|
||||
super(SubspecialtyFilter, self).__init__(
|
||||
data=data, queryset=queryset, prefix=prefix, request=request
|
||||
)
|
||||
pass
|
||||
|
||||
@@ -9,6 +9,7 @@ from .models import (
|
||||
Series,
|
||||
Structure,
|
||||
Finding,
|
||||
Subspecialty,
|
||||
)
|
||||
|
||||
from django.utils.html import format_html
|
||||
@@ -279,3 +280,27 @@ class PathologicalProcessTable(tables.Table):
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("name",)
|
||||
sequence = ("name",)
|
||||
|
||||
class SubspecialtyTable(tables.Table):
|
||||
name = tables.Column(
|
||||
linkify=("atlas:subspecialty_detail", {"pk": tables.A("pk")}),
|
||||
verbose_name="Subspecialty",
|
||||
)
|
||||
|
||||
#edit = tables.LinkColumn(
|
||||
# "atlas:subspecialty_update", text="Edit", args=[A("pk")], orderable=False
|
||||
#)
|
||||
#delete = tables.LinkColumn(
|
||||
# "atlas:subspecialty_delete", text="Delete", args=[A("pk")], orderable=False
|
||||
#)
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
class Meta:
|
||||
model = Subspecialty
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("primary", "subspecialty")
|
||||
sequence = ("name",)
|
||||
|
||||
def render_synonym(self, value, record):
|
||||
return format_html(record.get_synonym_link())
|
||||
return f"{record.get_synonym_link()}"
|
||||
|
||||
@@ -11,6 +11,7 @@ urlpatterns = [
|
||||
path("author/", views.author_list, name="author_list"),
|
||||
path("case/", views.CaseView.as_view(), name="case_view"),
|
||||
path("condition/", views.ConditionView.as_view(), name="condition_view"),
|
||||
path("subspecialty/", views.SubspecialtyView.as_view(), name="subspecialty_view"),
|
||||
path("categories/", views.categories_list, name="categories_list"),
|
||||
path("condition/<int:pk>", views.condition_detail, name="condition_detail"),
|
||||
path(
|
||||
|
||||
+9
-1
@@ -50,7 +50,7 @@ from .models import (
|
||||
SeriesFinding,
|
||||
SeriesImage,
|
||||
)
|
||||
from .tables import CaseTable, ConditionTable, FindingTable, PathologicalProcessTable, PresentationTable, SeriesTable, StructureTable
|
||||
from .tables import CaseTable, ConditionTable, FindingTable, PathologicalProcessTable, PresentationTable, SeriesTable, StructureTable, SubspecialtyTable
|
||||
from .filters import (
|
||||
CaseFilter,
|
||||
ConditionFilter,
|
||||
@@ -59,6 +59,7 @@ from .filters import (
|
||||
PresentationFilter,
|
||||
SeriesFilter,
|
||||
StructureFilter,
|
||||
SubspecialtyFilter,
|
||||
)
|
||||
|
||||
from django_tables2 import SingleTableView, SingleTableMixin
|
||||
@@ -639,6 +640,13 @@ class ConditionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = ConditionFilter
|
||||
|
||||
class SubspecialtyView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Subspecialty
|
||||
table_class = SubspecialtyTable
|
||||
template_name = "atlas/view.html"
|
||||
|
||||
filterset_class = SubspecialtyFilter
|
||||
|
||||
class PresentationView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Presentation
|
||||
table_class = PresentationTable
|
||||
|
||||
Reference in New Issue
Block a user