diff --git a/atlas/filters.py b/atlas/filters.py index 267c4e4c..64b51d12 100755 --- a/atlas/filters.py +++ b/atlas/filters.py @@ -1,6 +1,6 @@ import django_filters -from .models import Case, Condition, Finding, Series, Structure +from .models import Case, Condition, Finding, PathalogicalProcess, Presentation, Series, Structure from django.contrib.auth.models import User @@ -134,3 +134,42 @@ class StructureFilter(django_filters.FilterSet): data=data, queryset=queryset, prefix=prefix, request=request ) pass + +class PresentationFilter(django_filters.FilterSet): + class Meta: + model = Presentation + fields = ("name", "subspecialty") + + def __init__( + self, + data=None, + queryset=None, + prefix=None, + strict=None, + user=None, + request=None, + ): + super(PresentationFilter, self).__init__( + data=data, queryset=queryset, prefix=prefix, request=request + ) + pass + + +class PathologicalProcessFilter(django_filters.FilterSet): + class Meta: + model = PathalogicalProcess + fields = ("name") + + def __init__( + self, + data=None, + queryset=None, + prefix=None, + strict=None, + user=None, + request=None, + ): + super(PathologicalProcessFilter, self).__init__( + data=data, queryset=queryset, prefix=prefix, request=request + ) + pass diff --git a/atlas/models.py b/atlas/models.py index 56e85b9b..1c881951 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -131,7 +131,7 @@ class Condition(SynMixin, models.Model): return reverse("atlas:condition_detail", kwargs={"pk": self.pk}) -class Presentation(SynMixin, models.Model): +class Presentation(models.Model): name = models.CharField(max_length=255) subspecialty = models.ManyToManyField("subspecialty", blank=True) @@ -146,6 +146,9 @@ class Presentation(SynMixin, models.Model): def get_absolute_url(self): return reverse("atlas:presentation_detail", kwargs={"pk": self.pk}) + def get_link(self): + return format_html("{}", self.get_absolute_url(), self.name) + class Subspecialty(models.Model): name = models.CharField(max_length=255) @@ -156,6 +159,9 @@ class Subspecialty(models.Model): def get_absolute_url(self): return reverse("atlas:subspecialty_detail", kwargs={"pk": self.pk}) + def get_link(self): + return format_html("{}", self.get_absolute_url(), self.name) + class PathalogicalProcess(models.Model): name = models.CharField(max_length=255) @@ -166,6 +172,9 @@ class PathalogicalProcess(models.Model): def get_absolute_url(self): return reverse("atlas:pathalogical_process_detail", kwargs={"pk": self.pk}) + def get_link(self): + return format_html("{}", self.get_absolute_url(), self.name) + class Differential(models.Model): condition = models.ForeignKey(Condition, on_delete=models.CASCADE) diff --git a/atlas/tables.py b/atlas/tables.py index 794d6ea8..7d3d5f66 100755 --- a/atlas/tables.py +++ b/atlas/tables.py @@ -1,7 +1,7 @@ import django_tables2 as tables from django_tables2.utils import A -from .models import Case, Condition, Series, Structure, Finding +from .models import Case, Condition, PathalogicalProcess, Presentation, Series, Structure, Finding from django.utils.html import format_html @@ -225,4 +225,49 @@ class StructureTable(tables.Table): sequence = ("name",) def render_synonym(self, value, record): - return format_html(record.get_synonym_link()) \ No newline at end of file + return format_html(record.get_synonym_link()) + +class PresentationTable(tables.Table): + name = tables.Column( + linkify=("atlas:condition_detail", {"pk": tables.A("pk")}), + verbose_name="Presentation", + ) + + edit = tables.LinkColumn( + "atlas:condition_update", text="Edit", args=[A("pk")], orderable=False + ) + delete = tables.LinkColumn( + "atlas:condition_delete", text="Delete", args=[A("pk")], orderable=False + ) + selection = tables.CheckBoxColumn(accessor="pk", orderable=False) + + subspecialty = tables.ManyToManyColumn(verbose_name="Parents") + + class Meta: + model = Presentation + template_name = "django_tables2/bootstrap4.html" + fields = () + sequence = ("name",) + + +class PathologicalProcessTable(tables.Table): + name = tables.Column( + linkify=("atlas:condition_detail", {"pk": tables.A("pk")}), + verbose_name="PathologicalProcess", + ) + + edit = tables.LinkColumn( + "atlas:condition_update", text="Edit", args=[A("pk")], orderable=False + ) + delete = tables.LinkColumn( + "atlas:condition_delete", text="Delete", args=[A("pk")], orderable=False + ) + selection = tables.CheckBoxColumn(accessor="pk", orderable=False) + + subspecialty = tables.ManyToManyColumn(verbose_name="Parents") + + class Meta: + model = PathalogicalProcess + template_name = "django_tables2/bootstrap4.html" + fields = () + sequence = ("name",) \ No newline at end of file diff --git a/atlas/templates/atlas/case_display_block.html b/atlas/templates/atlas/case_display_block.html index da28aaf3..6a5d0da7 100755 --- a/atlas/templates/atlas/case_display_block.html +++ b/atlas/templates/atlas/case_display_block.html @@ -9,9 +9,18 @@
Description: {{ case.description }}
++ Presentation: +
History: {{ case.history }}
-History: {{ case.discussion }}
+Discussion: {{ case.discussion }}