lots of further updates

This commit is contained in:
Ross
2024-04-10 22:43:57 +01:00
parent 98756baa37
commit bf519a2807
14 changed files with 92 additions and 42 deletions
+4
View File
@@ -15,6 +15,8 @@ from .models import (
PathologicalProcess, PathologicalProcess,
Presentation, Presentation,
UncategorisedDicom, UncategorisedDicom,
SeriesDetail,
Resource
) )
from django.forms import ModelForm from django.forms import ModelForm
@@ -42,6 +44,8 @@ admin.site.register(PathologicalProcess)
admin.site.register(Presentation) admin.site.register(Presentation)
admin.site.register(CaseDetail) admin.site.register(CaseDetail)
admin.site.register(UncategorisedDicom) admin.site.register(UncategorisedDicom)
admin.site.register(SeriesDetail)
admin.site.register(Resource)
class DifferentialInline(admin.TabularInline): class DifferentialInline(admin.TabularInline):
+3
View File
@@ -23,6 +23,8 @@ from generic.models import Examination, Modality
from .models import Case, DuplicateDicom, Series, SeriesImage, UncategorisedDicom from .models import Case, DuplicateDicom, Series, SeriesImage, UncategorisedDicom
from loguru import logger
router = Router() router = Router()
@@ -52,6 +54,7 @@ class CaseSchema(ModelSchema):
model_fields = ["id", "title"] model_fields = ["id", "title"]
@logger.catch()
@router.post("/upload_dicom", auth=django_auth) @router.post("/upload_dicom", auth=django_auth)
def upload_dicom(request, files: List[UploadedFile] = File(...)): def upload_dicom(request, files: List[UploadedFile] = File(...)):
uploaded = [] uploaded = []
+3
View File
@@ -696,3 +696,6 @@ class CaseCollectionAuthorForm(ExamAuthorFormMixin):
class CaseAuthorForm(ExamAuthorFormMixin): class CaseAuthorForm(ExamAuthorFormMixin):
class Meta(ExamAuthorFormMixin.Meta): class Meta(ExamAuthorFormMixin.Meta):
model = Case model = Case
class SeriesAuthorForm(ExamAuthorFormMixin):
class Meta(ExamAuthorFormMixin.Meta):
model = Series
+10
View File
@@ -69,6 +69,8 @@ from django.contrib.contenttypes.fields import GenericRelation
from django.core.validators import MaxValueValidator, MinValueValidator from django.core.validators import MaxValueValidator, MinValueValidator
from loguru import logger
image_storage = FileSystemStorage( image_storage = FileSystemStorage(
# Physical file location ROOT # Physical file location ROOT
@@ -685,6 +687,13 @@ class Series(SeriesBase):
self.save() self.save()
def get_base_template(self):
return "atlas/base.html"
def get_link_headers(self):
return "atlas/series_headers.html"
class CaseCollection(ExamOrCollectionGenericBase): class CaseCollection(ExamOrCollectionGenericBase):
app_name = "atlas" app_name = "atlas"
@@ -1099,6 +1108,7 @@ class UncategorisedDicom(models.Model):
return duplicate return duplicate
@logger.catch()
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
"""Override save method to add image hash""" """Override save method to add image hash"""
if self.image: if self.image:
+1 -1
View File
@@ -71,7 +71,7 @@
<div class="alert alert-info" role="alert">Creating a case in the collection: <a href="{% url 'atlas:collection_detail' pk=form.collection.pk %}">{{form.collection.name}}</a></div> <div class="alert alert-info" role="alert">Creating a case in the collection: <a href="{% url 'atlas:collection_detail' pk=form.collection.pk %}">{{form.collection.name}}</a></div>
{% endif %} {% endif %}
<form action="" method="post" enctype="multipart/form-data" id="atlas-form"> <form class="highlight" action="" method="post" enctype="multipart/form-data" id="atlas-form">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}
@@ -33,7 +33,7 @@
{% endif %} {% endif %}
<form action="" method="post" enctype="multipart/form-data" id="atlas-form"> <form class="highlight" action="" method="post" enctype="multipart/form-data" id="atlas-form">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}
+1 -1
View File
@@ -8,7 +8,7 @@
Adding self feedback for {{user_exam.exam}}/{{case}} Adding self feedback for {{user_exam.exam}}/{{case}}
</div> </div>
<form action="" method="post"> <form class="highlight" action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form.non_field_errors }} {{ form.non_field_errors }}
+6 -5
View File
@@ -1,12 +1,13 @@
{% extends "atlas/base.html" %} {% extends "atlas/base.html" %}
{% block navigation%}
{{ block.super }}
{% include 'atlas/series_headers.html' %}
{% endblock %}
{% block content %} {% block content %}
<a href="{% url 'atlas:series_update' pk=series.pk %}" title="Edit the Series">Edit</a>
<a href="{% url 'atlas:series_delete' pk=series.pk %}" title="Delete the Series">Delete</a>
{% if request.user.is_superuser %}
<a href="{% url 'admin:atlas_series_change' series.id %}" title="Edit the Series using the admin interface">Admin Edit</a>
{% endif %}
{% include 'atlas/series_viewer.html' %} {% include 'atlas/series_viewer.html' %}
{% endblock %} {% endblock %}
+9
View File
@@ -410,7 +410,16 @@
{{ form.media }} {{ form.media }}
{% endblock %} {% endblock %}
{% block navigation%}
{{ block.super }}
{% if object %}
{% include "atlas/series_headers.html" %}
{% endif %}
{% endblock %}
{% block content %} {% block content %}
<h2>Series Form</h2> <h2>Series Form</h2>
This form will create a image set that can be associated with a atlas question. If the question has already been created This form will create a image set that can be associated with a atlas question. If the question has already been created
it can be linked below. it can be linked below.
@@ -0,0 +1,8 @@
<br/>
<a href="{% url 'atlas:series_detail' pk=series.pk %}" title="View the Series">View</a>
<a href="{% url 'atlas:series_update' pk=series.pk %}" title="Edit the Series">Edit</a>
<a href="{% url 'atlas:series_delete' pk=series.pk %}" title="Delete the Series">Delete</a>
<a href="{% url 'atlas:series_authors' pk=series.pk %}" title="Update the authors">Authors</a>
{% if request.user.is_superuser %}
<a href="{% url 'admin:atlas_series_change' series.id %}" title="Edit the Series using the admin interface">Admin Edit</a>
{% endif %}
+1
View File
@@ -242,6 +242,7 @@ urlpatterns = [
), ),
path("structure/create", views.StructureCreate.as_view(), name="structure_create"), path("structure/create", views.StructureCreate.as_view(), name="structure_create"),
path("series/<int:pk>", views.series_detail, name="series_detail"), path("series/<int:pk>", views.series_detail, name="series_detail"),
path("series/<int:pk>/authors", views.SeriesAuthorUpdate.as_view(), name="series_authors"),
path("series/", views.SeriesView.as_view(), name="series_view"), path("series/", views.SeriesView.as_view(), name="series_view"),
path("series_image/<int:pk>/dicom", views.series_image_dicom, name="series_image_dicom"), path("series_image/<int:pk>/dicom", views.series_image_dicom, name="series_image_dicom"),
path( path(
+11
View File
@@ -48,6 +48,7 @@ from .forms import (
FindingForm, FindingForm,
ResourceForm, ResourceForm,
SelfReviewForm, SelfReviewForm,
SeriesAuthorForm,
SeriesForm, SeriesForm,
SeriesImageFormSet, SeriesImageFormSet,
SeriesFormSet, SeriesFormSet,
@@ -2387,3 +2388,13 @@ class CaseAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
context = super(CaseAuthorUpdate, self).get_context_data(**kwargs) context = super(CaseAuthorUpdate, self).get_context_data(**kwargs)
context["collection"] = context["object"] context["collection"] = context["object"]
return context return context
class SeriesAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
model = Series
form_class = SeriesAuthorForm
template_name = "author_form.html"
def get_context_data(self, **kwargs):
context = super(SeriesAuthorUpdate, self).get_context_data(**kwargs)
context["collection"] = context["object"]
return context
+4 -4
View File
@@ -8,14 +8,14 @@ form>div:hover .helptext {
color: #666; color: #666;
opacity: 1; opacity: 1;
} }
form > div { form > div {
margin: 1px; margin: 1px;
} }
form > div:hover { form.highlight > div:hover {
border: 1px solid #666; /* border: 1px solid #666;
margin: -1px; margin: -1px; */
background-color: #002635;
} }