From 5c23549b5991f4babadc0d9ac91bd3aa7a447cf5 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 5 Dec 2021 19:02:20 +0000 Subject: [PATCH] . --- atlas/tables.py | 36 +++++++++++++------ atlas/templates/atlas/finding_detail.html | 25 +++++++++++++ .../atlas/series_confirm_delete.html | 1 - atlas/templates/atlas/structure_detail.html | 25 +++++++++++++ atlas/views.py | 4 +++ 5 files changed, 79 insertions(+), 12 deletions(-) create mode 100755 atlas/templates/atlas/finding_detail.html delete mode 100644 atlas/templates/atlas/series_confirm_delete.html create mode 100755 atlas/templates/atlas/structure_detail.html diff --git a/atlas/tables.py b/atlas/tables.py index dc65deb0..a06cbf0f 100755 --- a/atlas/tables.py +++ b/atlas/tables.py @@ -133,13 +133,10 @@ class SeriesTable(tables.Table): ) class ConditionTable(tables.Table): - name = tables.Column(linkify=('atlas:condition_detail', {'pk': tables.A('pk')})) + name = tables.Column(linkify=('atlas:condition_detail', {'pk': tables.A('pk')}), verbose_name="Condition") - #edit = tables.LinkColumn( - # "atlas:condition_update", text="Edit", args=[A("pk")], orderable=False - #) - view = tables.LinkColumn( - "atlas:condition_detail", text="View", args=[A("pk")], orderable=False + 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 @@ -157,12 +154,10 @@ class ConditionTable(tables.Table): class FindingTable(tables.Table): + name = tables.Column(linkify=('atlas:finding_detail', {'pk': tables.A('pk')}), verbose_name="Finding") edit = tables.LinkColumn( "atlas:finding_update", text="Edit", args=[A("pk")], orderable=False ) - view = tables.LinkColumn( - "atlas:finding_detail", text="View", args=[A("pk")], orderable=False - ) delete = tables.LinkColumn( "atlas:finding_delete", text="Delete", args=[A("pk")], orderable=False ) @@ -174,5 +169,24 @@ class FindingTable(tables.Table): class Meta: model = Finding template_name = "django_tables2/bootstrap4.html" - fields = ("name", "primary", "subspecialty") - sequence = () \ No newline at end of file + fields = ("name", "primary") + sequence = ("name",) + +class StructureTable(tables.Table): + name = tables.Column(linkify=('atlas:structure_detail', {'pk': tables.A('pk')}), verbose_name="Structure") + edit = tables.LinkColumn( + "atlas:structure_update", text="Edit", args=[A("pk")], orderable=False + ) + delete = tables.LinkColumn( + "atlas:structure_delete", text="Delete", args=[A("pk")], orderable=False + ) + selection = tables.CheckBoxColumn(accessor="pk", orderable=False) + + synonym = tables.ManyToManyColumn(verbose_name="Synonyms") + parent = tables.ManyToManyColumn(verbose_name="Parents") + + class Meta: + model = Structure + template_name = "django_tables2/bootstrap4.html" + fields = ("name", "primary") + sequence = ("name",) \ No newline at end of file diff --git a/atlas/templates/atlas/finding_detail.html b/atlas/templates/atlas/finding_detail.html new file mode 100755 index 00000000..112b42dd --- /dev/null +++ b/atlas/templates/atlas/finding_detail.html @@ -0,0 +1,25 @@ +{% extends 'atlas/base.html' %} + +{% block content %} + + + +
+ Edit + Delete + {% if request.user.is_superuser %} + Admin Edit + {% endif %} +
+
+

Name: {{finding.name}}

+ Primary name: {{finding.primary}}
+ Synonyms: {{finding.synonym.all|join:", "}}
+
+ +{% endblock %} + +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/atlas/templates/atlas/series_confirm_delete.html b/atlas/templates/atlas/series_confirm_delete.html deleted file mode 100644 index 10ac7f23..00000000 --- a/atlas/templates/atlas/series_confirm_delete.html +++ /dev/null @@ -1 +0,0 @@ -{% include 'confirm_delete.html' %} \ No newline at end of file diff --git a/atlas/templates/atlas/structure_detail.html b/atlas/templates/atlas/structure_detail.html new file mode 100755 index 00000000..926440ec --- /dev/null +++ b/atlas/templates/atlas/structure_detail.html @@ -0,0 +1,25 @@ +{% extends 'atlas/base.html' %} + +{% block content %} + + + +
+ Edit + Delete + {% if request.user.is_superuser %} + Admin Edit + {% endif %} +
+
+

Name: {{structure.name}}

+ Primary name: {{structure.primary}}
+ Synonyms: {{structure.synonym.all|join:", "}}
+
+ +{% endblock %} + +{% block js %} + +{% endblock %} \ No newline at end of file diff --git a/atlas/views.py b/atlas/views.py index 80eebae2..00f50d4e 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -221,18 +221,22 @@ class SeriesFindingDelete(RevisionMixin, PermissionRequiredMixin, DeleteView): class SeriesDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Series + template_name = "confirm_delete.html" success_url = reverse_lazy("atlas:series_view") class ConditionDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Condition + template_name = "confirm_delete.html" success_url = reverse_lazy("atlas:condition_view") class FindingDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Finding + template_name = "confirm_delete.html" success_url = reverse_lazy("atlas:finding_view") class StructureDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView): model = Structure + template_name = "confirm_delete.html" success_url = reverse_lazy("atlas:structure_view") @login_required