From a03c452d7cff01711b7b76797344ec9dd1143134 Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 28 Nov 2021 16:55:13 +0000 Subject: [PATCH] . --- atlas/forms.py | 6 +++++ atlas/templates/atlas/series_viewer.html | 6 +++++ atlas/views.py | 30 +++++++++++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/atlas/forms.py b/atlas/forms.py index 1f87853f..ba354fa1 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -12,6 +12,7 @@ from atlas.models import ( Case, Series, SeriesImage, + SeriesFindings ) from anatomy.models import Modality @@ -32,6 +33,11 @@ class ExaminationForm(ModelForm): fields = ["examination"] +class SeriesFindingsForm(ModelForm): + class Meta: + model = SeriesFindings + exclude = [""] + class SeriesForm(ModelForm): class Media: # Django also includes a few javascript files necessary diff --git a/atlas/templates/atlas/series_viewer.html b/atlas/templates/atlas/series_viewer.html index 41fc403c..bd42a01f 100755 --- a/atlas/templates/atlas/series_viewer.html +++ b/atlas/templates/atlas/series_viewer.html @@ -11,6 +11,12 @@ This series is not associated with any cases.
+
+ {% csrf_token %} + {{ series_finding_form }} + +
+
Author: {{ series.get_author_display }}
Image info diff --git a/atlas/views.py b/atlas/views.py index 84284eb9..40568541 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -30,11 +30,16 @@ from .forms import ( SeriesImageFormSet, SeriesFormSet, ExaminationForm, + SeriesFindingsForm ) from .models import ( Case, Series, Examination, + Finding, + Subspecialty, + SeriesFindings, + SeriesImage ) from .tables import AtlasTable, SeriesTable from .filters import AtlasFilter, SeriesFilter @@ -112,9 +117,11 @@ def series_detail(request, pk): # if request.user not in atlas.author.all(): # raise PermissionDenied + series_finding_form = SeriesFindingsForm() + # logging.debug(atlas.subspecialty.first().name.all()) - return render(request, "atlas/series.html", {"series": series}) + return render(request, "atlas/series.html", {"series": series, "series_finding_form": series_finding_form}) @login_required @@ -508,3 +515,24 @@ class SeriesImagesZipView(SuperuserRequiredMixin, BaseZipView): series = Series.objects.get(pk=self.kwargs["pk"]) return [i.image.file for i in series.images.all()] + +def create_series_findings(request): + #posts = Post.objects.all() + response_data = {} + + if request.POST.get('action') == 'post': + series = request.POST.get('series') + findings = request.POST.get('findings') + description = request.POST.get('description') + annotation_json = request.POST.get('annotation_json') + + sf = SeriesFindings.create( + series = series, + findings = findings, + description = description, + annotation_json = annotation_json, + ) + return JsonResponse({"success":True}) + + return JsonResponse({"success": False}) + return render(request, 'create_post.html', {'posts':posts}) \ No newline at end of file