From bf519a280712bd1b41ed08f664b46fc0db7163a7 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 10 Apr 2024 22:43:57 +0100 Subject: [PATCH] lots of further updates --- atlas/admin.py | 4 ++ atlas/api.py | 3 + atlas/forms.py | 5 +- atlas/models.py | 10 +++ atlas/templates/atlas/case_form.html | 2 +- .../templates/atlas/casecollection_form.html | 2 +- atlas/templates/atlas/selfreview_form.html | 2 +- atlas/templates/atlas/series.html | 11 ++-- atlas/templates/atlas/series_form.html | 65 +++++++++++-------- atlas/templates/atlas/series_headers.html | 8 +++ atlas/urls.py | 1 + atlas/views.py | 11 ++++ rad/static/css/forms.css | 8 +-- templates/author_form.html | 2 +- 14 files changed, 92 insertions(+), 42 deletions(-) create mode 100644 atlas/templates/atlas/series_headers.html diff --git a/atlas/admin.py b/atlas/admin.py index a43e60e4..a35f5611 100755 --- a/atlas/admin.py +++ b/atlas/admin.py @@ -15,6 +15,8 @@ from .models import ( PathologicalProcess, Presentation, UncategorisedDicom, + SeriesDetail, + Resource ) from django.forms import ModelForm @@ -42,6 +44,8 @@ admin.site.register(PathologicalProcess) admin.site.register(Presentation) admin.site.register(CaseDetail) admin.site.register(UncategorisedDicom) +admin.site.register(SeriesDetail) +admin.site.register(Resource) class DifferentialInline(admin.TabularInline): diff --git a/atlas/api.py b/atlas/api.py index c2678305..a0d29556 100644 --- a/atlas/api.py +++ b/atlas/api.py @@ -23,6 +23,8 @@ from generic.models import Examination, Modality from .models import Case, DuplicateDicom, Series, SeriesImage, UncategorisedDicom +from loguru import logger + router = Router() @@ -52,6 +54,7 @@ class CaseSchema(ModelSchema): model_fields = ["id", "title"] +@logger.catch() @router.post("/upload_dicom", auth=django_auth) def upload_dicom(request, files: List[UploadedFile] = File(...)): uploaded = [] diff --git a/atlas/forms.py b/atlas/forms.py index 021695ef..7500f73a 100755 --- a/atlas/forms.py +++ b/atlas/forms.py @@ -695,4 +695,7 @@ class CaseCollectionAuthorForm(ExamAuthorFormMixin): class CaseAuthorForm(ExamAuthorFormMixin): class Meta(ExamAuthorFormMixin.Meta): - model = Case \ No newline at end of file + model = Case +class SeriesAuthorForm(ExamAuthorFormMixin): + class Meta(ExamAuthorFormMixin.Meta): + model = Series \ No newline at end of file diff --git a/atlas/models.py b/atlas/models.py index 9cb3a26b..21abc328 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -69,6 +69,8 @@ from django.contrib.contenttypes.fields import GenericRelation from django.core.validators import MaxValueValidator, MinValueValidator +from loguru import logger + image_storage = FileSystemStorage( # Physical file location ROOT @@ -685,6 +687,13 @@ class Series(SeriesBase): self.save() + def get_base_template(self): + return "atlas/base.html" + + def get_link_headers(self): + return "atlas/series_headers.html" + + class CaseCollection(ExamOrCollectionGenericBase): app_name = "atlas" @@ -1099,6 +1108,7 @@ class UncategorisedDicom(models.Model): return duplicate + @logger.catch() def save(self, *args, **kwargs): """Override save method to add image hash""" if self.image: diff --git a/atlas/templates/atlas/case_form.html b/atlas/templates/atlas/case_form.html index a1fbeb0a..2d7cd002 100755 --- a/atlas/templates/atlas/case_form.html +++ b/atlas/templates/atlas/case_form.html @@ -71,7 +71,7 @@ {% endif %} -
+ {% csrf_token %} {{ form }} diff --git a/atlas/templates/atlas/casecollection_form.html b/atlas/templates/atlas/casecollection_form.html index 4b926578..38aecb7f 100755 --- a/atlas/templates/atlas/casecollection_form.html +++ b/atlas/templates/atlas/casecollection_form.html @@ -33,7 +33,7 @@ {% endif %} - + {% csrf_token %} {{ form }} diff --git a/atlas/templates/atlas/selfreview_form.html b/atlas/templates/atlas/selfreview_form.html index a5a2d093..1e9aaf2c 100644 --- a/atlas/templates/atlas/selfreview_form.html +++ b/atlas/templates/atlas/selfreview_form.html @@ -8,7 +8,7 @@ Adding self feedback for {{user_exam.exam}}/{{case}} - + {% csrf_token %} {{ form.non_field_errors }} diff --git a/atlas/templates/atlas/series.html b/atlas/templates/atlas/series.html index 3588a2aa..f91f579e 100755 --- a/atlas/templates/atlas/series.html +++ b/atlas/templates/atlas/series.html @@ -1,12 +1,13 @@ {% extends "atlas/base.html" %} +{% block navigation%} + + {{ block.super }} + {% include 'atlas/series_headers.html' %} +{% endblock %} + {% block content %} - Edit - Delete - {% if request.user.is_superuser %} - Admin Edit - {% endif %} {% include 'atlas/series_viewer.html' %} {% endblock %} diff --git a/atlas/templates/atlas/series_form.html b/atlas/templates/atlas/series_form.html index bb008de8..468de11f 100755 --- a/atlas/templates/atlas/series_form.html +++ b/atlas/templates/atlas/series_form.html @@ -6,8 +6,8 @@