From 81dc5bf48f36463d7bb0bdc2604399b8150d58d2 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 17 Nov 2025 23:01:02 +0000 Subject: [PATCH] Add forms and views for subspecialty, presentation, and pathological process management --- atlas/forms.py | 20 ++++++++++++++++ atlas/templates/atlas/base.html | 3 +++ .../atlas/pathological_process_form.html | 23 +++++++++++++++++++ atlas/templates/atlas/presentation_form.html | 23 +++++++++++++++++++ atlas/templates/atlas/subspecialty_form.html | 23 +++++++++++++++++++ atlas/urls.py | 3 +++ atlas/views.py | 21 +++++++++++++++++ 7 files changed, 116 insertions(+) create mode 100644 atlas/templates/atlas/pathological_process_form.html create mode 100644 atlas/templates/atlas/presentation_form.html create mode 100644 atlas/templates/atlas/subspecialty_form.html diff --git a/atlas/forms.py b/atlas/forms.py index 91a73cdd..fd0041bf 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -40,6 +40,8 @@ from atlas.models import ( Condition, Structure, Subspecialty, + Presentation, + PathologicalProcess, UncategorisedDicom, UserReportAnswer, CaseDisplaySet, @@ -333,6 +335,24 @@ class StructureForm(ModelForm): } +class SubspecialtyForm(ModelForm): + class Meta: + model = Subspecialty + exclude = [] + + +class PresentationForm(ModelForm): + class Meta: + model = Presentation + exclude = [] + + +class PathologicalProcessForm(ModelForm): + class Meta: + model = PathologicalProcess + exclude = [] + + class SeriesFindingForm(ModelForm): class Meta: model = SeriesFinding diff --git a/atlas/templates/atlas/base.html b/atlas/templates/atlas/base.html index 7179844b..385a2fd5 100755 --- a/atlas/templates/atlas/base.html +++ b/atlas/templates/atlas/base.html @@ -87,6 +87,9 @@
  • New condition
  • New finding
  • New structure
  • +
  • New subspecialty
  • +
  • New presentation
  • +
  • New pathological process
  • {% endif %} diff --git a/atlas/templates/atlas/pathological_process_form.html b/atlas/templates/atlas/pathological_process_form.html new file mode 100644 index 00000000..27fc37c3 --- /dev/null +++ b/atlas/templates/atlas/pathological_process_form.html @@ -0,0 +1,23 @@ +{% extends "atlas/base.html" %} +{% load crispy_forms_tags %} + +{% block js %} + {{ form.media }} +{% endblock %} + +{% block content %} +

    Add / Edit Pathological process

    +

    Use this form to create or edit a pathological process.

    +

    Please check if it already exists before doing so!

    + +
    + {% csrf_token %} + {% crispy form %} + +
    + + Cancel +
    +
    + +{% endblock %} diff --git a/atlas/templates/atlas/presentation_form.html b/atlas/templates/atlas/presentation_form.html new file mode 100644 index 00000000..04055915 --- /dev/null +++ b/atlas/templates/atlas/presentation_form.html @@ -0,0 +1,23 @@ +{% extends "atlas/base.html" %} +{% load crispy_forms_tags %} + +{% block js %} + {{ form.media }} +{% endblock %} + +{% block content %} +

    Add / Edit Presentation

    +

    Use this form to create or edit a presentation.

    +

    Please check if it already exists before doing so!

    + +
    + {% csrf_token %} + {% crispy form %} + +
    + + Cancel +
    +
    + +{% endblock %} diff --git a/atlas/templates/atlas/subspecialty_form.html b/atlas/templates/atlas/subspecialty_form.html new file mode 100644 index 00000000..219c714f --- /dev/null +++ b/atlas/templates/atlas/subspecialty_form.html @@ -0,0 +1,23 @@ +{% extends "atlas/base.html" %} +{% load crispy_forms_tags %} + +{% block js %} + {{ form.media }} +{% endblock %} + +{% block content %} +

    Add / Edit Subspecialty

    +

    Use this form to create or edit a subspecialty.

    +

    Please check if it already exists before doing so!

    + +
    + {% csrf_token %} + {% crispy form %} + +
    + + Cancel +
    +
    + +{% endblock %} diff --git a/atlas/urls.py b/atlas/urls.py index 8bc4cc74..17557772 100755 --- a/atlas/urls.py +++ b/atlas/urls.py @@ -423,6 +423,7 @@ urlpatterns = [ path( "subspecialty/", views.subspecialty_detail, name="subspecialty_detail" ), + path("subspecialty/create", views.SubspecialtyCreate.as_view(), name="subspecialty_create"), path("condition/create", views.ConditionCreate.as_view(), name="condition_create"), path("finding/", views.FindingView.as_view(), name="finding_view"), path("finding/", views.finding_detail, name="finding_detail"), @@ -596,6 +597,7 @@ urlpatterns = [ path( "presentation/", views.presentation_detail, name="presentation_detail" ), + path("presentation/create", views.PresentationCreate.as_view(), name="presentation_create"), path( "process/", views.PathologicalProcessView.as_view(), @@ -606,6 +608,7 @@ urlpatterns = [ views.pathological_process_detail, name="pathological_process_detail", ), + path("process/create", views.PathologicalProcessCreate.as_view(), name="pathological_process_create"), path("combine_series/", views.combine_series, name="combine_series"), path( "case//linked/", diff --git a/atlas/views.py b/atlas/views.py index d9574abd..fad32331 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -83,6 +83,9 @@ from .forms import ( SeriesFindingForm, CaseDifferentialFormSet, StructureForm, + SubspecialtyForm, + PresentationForm, + PathologicalProcessForm, UserQuestionAnswerForm, UserReportAnswerForm, ) @@ -1686,6 +1689,24 @@ class StructureCreate(RevisionMixin, LoginRequiredMixin, CreateView): form_class = StructureForm +class SubspecialtyCreate(RevisionMixin, LoginRequiredMixin, CreateView): + model = Subspecialty + form_class = SubspecialtyForm + template_name = "atlas/subspecialty_form.html" + + +class PresentationCreate(RevisionMixin, LoginRequiredMixin, CreateView): + model = Presentation + form_class = PresentationForm + template_name = "atlas/presentation_form.html" + + +class PathologicalProcessCreate(RevisionMixin, LoginRequiredMixin, CreateView): + model = PathologicalProcess + form_class = PathologicalProcessForm + template_name = "atlas/pathological_process_form.html" + + class AtlasCreateBase(RevisionMixin, LoginRequiredMixin): model = Case form_class = CaseForm