improve dicom uploading

This commit is contained in:
Ross
2023-10-23 13:36:41 +01:00
parent c786019af1
commit 0f3bc68de6
28 changed files with 464 additions and 172 deletions
+16 -5
View File
@@ -66,11 +66,17 @@ def upload_dicom(request, files: List[UploadedFile] = File(...)):
return {"uploaded": uploaded, "duplicates": duplicate}
@router.get("/clear_dicoms", auth=django_auth)
@router.post("/clear_dicoms", auth=django_auth)
def clear_dicoms(request):
dicoms = UncategorisedDicom.objects.filter(user=request.user)
if "selection" in request.POST:
dicoms = UncategorisedDicom.objects.filter(series_instance_uid__in=request.POST.getlist("selection"))
else:
dicoms = UncategorisedDicom.objects.filter(user=request.user)
dicoms.delete()
print(dicoms)
return True
@@ -90,7 +96,12 @@ def uncategorised_dicoms(request):
def import_dicoms_helper(request, case_id: int | None = None):
dicoms = UncategorisedDicom.objects.filter(user=request.user)
#dicoms = UncategorisedDicom.objects.filter(user=request.user)
if "selection" in request.POST:
dicoms = UncategorisedDicom.objects.filter(series_instance_uid__in=request.POST.getlist("selection"))
else:
dicoms = UncategorisedDicom.objects.filter(user=request.user)
data = defaultdict(list)
for d in dicoms:
@@ -136,12 +147,12 @@ def import_dicoms_helper(request, case_id: int | None = None):
return series_list
@router.get("/import_dicoms", auth=django_auth, response=List[SeriesSchema])
@router.post("/import_dicoms", auth=django_auth, response=List[SeriesSchema])
def import_dicoms(request):
return import_dicoms_helper(request)
@router.get("/import_dicoms/{case_id}", auth=django_auth, response=List[SeriesSchema])
@router.post("/import_dicoms/{case_id}", auth=django_auth, response=List[SeriesSchema])
def import_dicoms_case(request, case_id: int):
return import_dicoms_helper(request, case_id=case_id)
+1 -1
View File
@@ -223,7 +223,7 @@ class SeriesForm(ModelForm):
class Meta:
model = Series
exclude = ["author"]
exclude = ["author", "series_instance_uid"]
widgets = {
"examination": autocomplete.ModelSelect2(
@@ -0,0 +1,25 @@
# Generated by Django 4.1.4 on 2023-10-23 08:53
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('atlas', '0016_remove_uncategoriseddicom_is_dicom'),
]
operations = [
migrations.AddField(
model_name='series',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='series',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]
@@ -0,0 +1,23 @@
# Generated by Django 4.1.4 on 2023-10-23 09:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('atlas', '0017_series_created_at_series_updated_at'),
]
operations = [
migrations.RenameField(
model_name='series',
old_name='created_at',
new_name='created_date',
),
migrations.RenameField(
model_name='series',
old_name='updated_at',
new_name='modified_date',
),
]
@@ -0,0 +1,19 @@
# Generated by Django 4.1.4 on 2023-10-23 10:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atlas', '0018_rename_created_at_series_created_date_and_more'),
]
operations = [
migrations.AddField(
model_name='uncategoriseddicom',
name='series_instance_uid',
field=models.CharField(default='test', max_length=255),
preserve_default=False,
),
]
@@ -0,0 +1,18 @@
# Generated by Django 4.1.4 on 2023-10-23 10:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atlas', '0019_uncategoriseddicom_series_instance_uid'),
]
operations = [
migrations.AlterField(
model_name='uncategoriseddicom',
name='series_instance_uid',
field=models.CharField(default='', max_length=255),
),
]
@@ -0,0 +1,18 @@
# Generated by Django 4.1.4 on 2023-10-23 10:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('atlas', '0020_alter_uncategoriseddicom_series_instance_uid'),
]
operations = [
migrations.AlterField(
model_name='uncategoriseddicom',
name='series_instance_uid',
field=models.CharField(default='', max_length=255, null=True),
),
]
@@ -0,0 +1,24 @@
# Generated by Django 4.1.4 on 2023-10-23 11:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('atlas', '0021_alter_uncategoriseddicom_series_instance_uid'),
]
operations = [
migrations.AlterField(
model_name='uncategoriseddicom',
name='series',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='imported_dicoms', to='atlas.series'),
),
migrations.AlterField(
model_name='uncategoriseddicom',
name='series_instance_uid',
field=models.CharField(blank=True, max_length=255, null=True),
),
]
+9 -3
View File
@@ -811,9 +811,11 @@ class UncategorisedDicom(models.Model):
)
series = models.ForeignKey(
"Series", related_name="imported_dicoms", on_delete=models.SET_NULL, null=True
"Series", related_name="imported_dicoms", on_delete=models.SET_NULL, null=True, blank=True
)
series_instance_uid = models.CharField(max_length=255, blank=True, null=True)
image_md5_hash = models.CharField(max_length=32, null=True, blank=True)
def check_for_duplicates(self, image_hash):
@@ -833,10 +835,14 @@ class UncategorisedDicom(models.Model):
def save(self, *args, **kwargs):
"""Override save method to add image hash"""
if self.image:
ds = self.get_dicom_info()
self.series_instance_uid = ds["SeriesInstanceUID"].value
# if self.check_for_duplicates():
# return DuplicateDicom
image_hash = get_image_dicom_hash(self.image)
image_hash = get_image_dicom_hash(None, dataset=ds)
self.image_md5_hash = image_hash
+2
View File
@@ -110,6 +110,8 @@ class SeriesTable(tables.Table):
"plane",
"contrast",
"author",
"created_date",
"modified_date",
)
sequence = ("view", "popup", "images", "case")
@@ -1,5 +1,5 @@
<div class="atlas {% if case.scrapped %}atlas-scrapped{% endif %}">
<div><a href="https://viewer.penracourses.org.uk/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}"">View case in OHIF</a></div>
<div><a href="https://viewer.penracourses.org.uk/viewer/dicomjson?url=https://www.penracourses.org.uk{% url 'atlas:case_dicom_json' case.pk %}">View case in OHIF</a></div>
<div class="date">
{{ case.created_date|date:"d/m/Y" }}
@@ -42,7 +42,10 @@
</span>
</span>
{% endfor %}
<a href="{% url 'atlas:series_id_create' pk=case.pk %}">Add new series</a><br />
<span>
<a href="{% url 'atlas:series_id_create' pk=case.pk %}">Add new series</a><br />
<a href="{% url 'atlas:user_uploads_case' case_id=case.pk %}">Import new uploads</a><br />
</span>
</div>
{% comment %} <p><b>Scrapped:</b> {{ case.scrapped }} <a
href="{% url 'atlas:case_scrap' pk=case.pk %}">(toggle)</a> {% endcomment %}
+1 -1
View File
@@ -411,7 +411,7 @@
{{ form.media }}
{% endblock %}
{% block content %}
<h2>Add Series</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
it can be linked below.
<form action="" method="post" enctype="multipart/form-data" id="atlas-form">
+38 -29
View File
@@ -2,46 +2,55 @@
{% block content %}
<h2>Uploaded dicoms</h2>
Click to select cases to import. If no cases are selected all will be seleced/imported.
{% if series_list %}
<ul>
{% for series, n, tags in series_list %}
<li>
{{series}} [{{n}} images] <br/>
{{tags}}
</li>
{% endfor %}
</ul>
<ul id="series-list">
{% for series, n, tags in series_list %}
<li _="
on click toggle .selected on me
then set i to the first <input/> in me
then set i.checked to not i.checked" >
{{series}} [{{n}} images] <br/>
{{tags}}
<input class="hidden" type="checkbox" name="selection" value="{{ series }}">
</li>
{% endfor %}
</ul>
{% if case %}
<p>Importing into case {{case}}</p>
{% endif %}
{% if case %}
<p>Importing into case {{case}}</p>
{% endif %}
<button
hx-get="{% url 'api-1:clear_dicoms' %}"
hx-confirm="This will clear all uploads that have not been imported into series, Continue?"
>Delete Uploads</button>
{% if case %}
<button
hx-get="{% url 'api-1:import_dicoms_case' case.id %}"
hx-target=".imported"
>Import</button>
<button id="delete-uploads-button"
hx-post="{% url 'api-1:clear_dicoms' %}"
hx-include="[name='selection']"
hx-confirm="This will clear selected uploads, Continue?"
title="Deleted selected uploads"
>Delete Uploads</button>
{% if case %}
<button id="import-dicoms-case-button"
hx-post="{% url 'api-1:import_dicoms_case' case.id %}"
hx-target=".imported"
hx-include=".selected"
>Import into case</button>
{% else %}
<button
hx-get="{% url 'api-1:import_dicoms' %}"
hx-target=".imported"
>Import</button>
{% endif %}
{% else %}
<button id="import-dicoms-button"
hx-post="{% url 'api-1:import_dicoms' %}"
hx-target=".imported"
hx-include=".selected"
>Import</button>
{% endif %}
<div class="imported">
<div class="imported">
</div>
</div>
{% else %}
No uploads awaiting importing have been found.
{% endif %}
<p><a href="{% url 'atlas:series_view' %}?case=null">View orphan series</a></p>
<p><a href="{% url 'atlas:series_view' %}?case=null&sort=-modified_date">View orphan series</a></p>
{% endblock %}
+1 -1
View File
@@ -35,7 +35,7 @@ urlpatterns = [
path("collection/", views.CollectionView.as_view(), name="collection_view"),
path("collection/user", views.user_collections, name="user_collections"),
path("uploads", views.user_uploads, name="user_uploads"),
path("uploads/case/<int:case_id>", views.user_uploads, name="user_uploads"),
path("uploads/case/<int:case_id>", views.user_uploads, name="user_uploads_case"),
path(
"collection/create",
views.CaseCollectionCreate.as_view(),
+3 -1
View File
@@ -36,6 +36,7 @@ class CidUserFilter(django_filters.FilterSet):
class UserUserFilter(django_filters.FilterSet):
userprofile__grade = django_filters.ModelChoiceFilter(queryset=UserGrades.objects.all(),label="Grade")
userprofile__supervisor = django_filters.ModelChoiceFilter(queryset=Supervisor.objects.all(), label="Supervisor")
userprofile__peninsula_trainee = django_filters.BooleanFilter(label="Peninsula Trainee")
#has_supervisor = django_filters.BooleanFilter(field_name='supervisor', lookup_expr='isnull', exclude=True, label="Has Supervisor")
class Meta:
@@ -50,7 +51,8 @@ class UserUserFilter(django_filters.FilterSet):
#"userprofile__grade": ["exact"],
#"userprofile__supervisor": ["exact"],
"email": ["contains"],
"is_active": ["exact"]
"is_active": ["exact"],
"groups": ["exact"],
}
@property
+4
View File
@@ -230,6 +230,9 @@ class SeriesBase(models.Model):
help_text="If a series should be freely available to browse", default=True
)
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
@@ -1271,6 +1274,7 @@ class UserProfile(models.Model):
on_delete=models.CASCADE,
)
peninsula_trainee = models.BooleanField(default=False)
#affiliation = models.ForeignKey("Site", on_delete=models.SET_NULL, blank=True, null=True)
def getusername(self):
return self.user.username
+5 -1
View File
@@ -252,8 +252,12 @@ class UserUserTable(tables.Table):
return "Edit"
def render_user(self, value, record):
span_class = ""
if record.userprofile.peninsula_trainee:
span_class = "peninsula-trainee"
return format_html(
"{} {}<br/>{}<br/>{}",
"<div style='flex-flow: row wrap; display: flex;'><div class='{}'></div><div>{} {}<br/>{}<br/>{}</div></div>",
span_class,
record.first_name,
record.last_name,
record.username,
+4 -2
View File
@@ -155,8 +155,10 @@ def print_dicom(dataset, indent=0):
repr_value))
return "\n<br/>".join(l)
def get_image_dicom_hash(img) -> (str, bool):
dataset = pydicom.dcmread(img)
def get_image_dicom_hash(img, dataset=None) -> (str, bool):
if dataset is None:
dataset = pydicom.dcmread(img)
md5 = hashlib.md5()
first = True
for i in dataset.pixel_array.astype(str).flatten():
@@ -0,0 +1,25 @@
# Generated by Django 4.1.4 on 2023-10-23 08:53
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('longs', '0008_alter_longseriesimage_series'),
]
operations = [
migrations.AddField(
model_name='longseries',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='longseries',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]
@@ -0,0 +1,23 @@
# Generated by Django 4.1.4 on 2023-10-23 09:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('longs', '0009_longseries_created_at_longseries_updated_at'),
]
operations = [
migrations.RenameField(
model_name='longseries',
old_name='created_at',
new_name='created_date',
),
migrations.RenameField(
model_name='longseries',
old_name='updated_at',
new_name='modified_date',
),
]
+1 -1
View File
@@ -317,7 +317,7 @@
{{ form.media }}
{% endblock %}
{% block content %}
<h2>Add Series</h2>
<h2>Series Form</h2>
<!-- <a href="{% url 'longs:long_create_defaults' %}">Edit defaults</a> -->
This form will create a image set that can be associated with a long question. If the question has already been created it can be linked below.
<form action="" method="post" enctype="multipart/form-data" id="long-form">
+2
View File
@@ -20,6 +20,8 @@ class UserListFilter(django_filters.FilterSet):
"username": ["contains"],
"email": ["contains"],
"userprofile__grade": ["exact"],
"userprofile__peninsula_trainee": ["exact"],
}
# def __init__(self, data=None, queryset=None, *, request=None, prefix=None):
+18 -2
View File
@@ -73,7 +73,7 @@ a:link {
font-size: 20;
}
.hide {
.hide, .hidden {
display: none;
}
@@ -712,7 +712,8 @@ input {
text-decoration: underline;
}
.date,.small-gray {
.date,
.small-gray {
font-size: smaller;
opacity: 50%;
}
@@ -1039,4 +1040,19 @@ h6 {
background-color: black;
width: 100%;
}
table .peninsula-trainee::before {
content: "Trainee";
transform: rotate(-90deg) translate(-45px, -10px);
color: darkblue;
display: inline-block;
float: left;
width: 20px;
}
#series-list .selected {
color: white;
background-color: #52057b;
user-select: none;
}
+29 -1
View File
@@ -600,7 +600,7 @@ class UpdateUserView(CidManagerRequiredMixin, UpdateView):
return reverse(view_name, kwargs={"slug": self.object.username})
class UpdateUserProfileView(CidManagerRequiredMixin, UpdateView):
class UpdateUserProfileAdminView(CidManagerRequiredMixin, UpdateView):
model = UserProfile
fields = [
"supervisor",
@@ -617,6 +617,34 @@ class UpdateUserProfileView(CidManagerRequiredMixin, UpdateView):
# No need for reverse_lazy here, because it's called inside the method
return reverse(view_name, kwargs={"slug": self.object.username})
class UpdateUserProfileView(UpdateView):
model = UserProfile
fields = [
"supervisor",
"grade",
"registration_number",
#"peninsula_trainee",
] # Keep listing whatever fields
template_name = "user_update_profile.html"
slug_field = "user__username"
slug_url_kwarg = "slug"
def dispatch(self, request, *args, **kwargs):
if request.user.is_superuser or request.user.groups.filter(name="cid_user_manager").exists():
self.fields = ["supervisor", "grade", "registration_number", "peninsula_trainee"]
# Check permissions for the request.user here
elif request.user.userprofile.peninsula_trainee:
self.fields = ["supervisor", "grade", "registration_number"]
else:
self.fields = ["grade", "registration_number"]
return super().dispatch(request, *args, **kwargs)
def get_success_url(self):
view_name = "account_profile"
# No need for reverse_lazy here, because it's called inside the method
return reverse(view_name, kwargs={"slug": self.object.username})
# class UpdateUser(TemplateView):
#
@@ -0,0 +1,18 @@
# Generated by Django 4.1.4 on 2023-10-23 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sbas', '0002_exam_candidates_only_alter_exam_active_and_more'),
]
operations = [
migrations.AlterField(
model_name='useranswer',
name='answer',
field=models.CharField(choices=[('a', 'a_answer'), ('b', 'b_answer'), ('c', 'c_answer'), ('d', 'd_answer'), ('e', 'e_answer')], help_text='The user selected answer', max_length=20),
),
]
+115 -115
View File
@@ -5,133 +5,133 @@
{% load auth_extras %}
<html>
<head>
<title>
{% block title %}
PENRA Courses
{% endblock %}
</title>
<head>
<title>
{% block title %}
PENRA Courses
{% endblock %}
</title>
{% comment %} <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" /> {% endcomment %}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link href="{% static 'css/widgets.css' %}" type="text/css" media="all" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/dicomViewer.css' %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css" integrity="sha512-6S2HWzVFxruDlZxI3sXOZZ4/eJ8AcxkQH1+JjSe/ONCEqR9L4Ysq5JdT5ipqtzU7WHalNwzwBv+iE51gNHJNqQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link href="{% static 'css/widgets.css' %}" type="text/css" media="all" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/dicomViewer.css' %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.css" integrity="sha512-6S2HWzVFxruDlZxI3sXOZZ4/eJ8AcxkQH1+JjSe/ONCEqR9L4Ysq5JdT5ipqtzU7WHalNwzwBv+iE51gNHJNqQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link href="/static/css/widgets.css" type="text/css" media="all" rel="stylesheet">
<link href="/static/admin/css/vendor/select2/select2.min.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/admin/css/autocomplete.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/autocomplete_light/select2.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/css/widgets.css" type="text/css" media="all" rel="stylesheet">
<link href="/static/admin/css/vendor/select2/select2.min.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/admin/css/autocomplete.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/autocomplete_light/select2.css" type="text/css" media="screen" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/core.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/core.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/md5.js"></script>
{% comment %} <script src="https://unpkg.com/alpinejs" defer></script> {% endcomment %}
<script src="https://unpkg.com/hyperscript.org@0.9.7"></script>
<script src="https://unpkg.com/htmx.org@1.8.5/dist/htmx.min.js" defer></script>
{% django_htmx_script %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="{% static 'admin/js/core.js' %}"></script>
<script src="{% static 'admin/js/SelectBox.js' %}"></script>
<script src="{% static 'admin/js/SelectFilter2.js' %}"></script>
<script src="{% static 'jsi18n.js' %}"></script>
<script src="{% static 'admin/js/vendor/select2/select2.full.js' %}"></script>
<script src="{% static 'autocomplete_light/autocomplete_light.min.js' %}"></script>
<script src="{% static 'tesseract.min.js' %}"></script>
<script src="{% static 'autocomplete_light/select2.min.js' %}"></script>
<script src="{% static 'autocomplete_light/i18n/en.js' %}"></script>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.0.3/dexie.min.js" integrity="sha512-aEtNzq8X5E0ambgeM68H174SOXaANJ6wDqJ0TuVIx4R2J4fRdUA0nLzx0faA1mmViqb+r0VX7cOXkskxyJENUA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5sortable/0.10.0/html5sortable.min.js" integrity="sha512-tBlVMq89XaEC9iU5LyRjP2Vxs8SmVhEHGbv2Co6SbGa14Wsxy2qZN0jadrN+Xn5AifORaUbvZcG21/ExcNfWDA==" crossorigin="anonymous"></script>
<script src="{% static 'tesseract.min.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js" integrity="sha512-lbwH47l/tPXJYG9AcFNoJaTMhGvYWhVM9YI43CT+uteTRRaiLCui8snIgyAN8XWgNjNhCqlAUdzZptso6OCoFQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="https://unpkg.com/hyperscript.org@0.9.7"></script>
<script src="https://unpkg.com/htmx.org@1.8.5/dist/htmx.min.js" defer></script>
{% django_htmx_script %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="{% static 'admin/js/core.js' %}"></script>
<script src="{% static 'admin/js/SelectBox.js' %}"></script>
<script src="{% static 'admin/js/SelectFilter2.js' %}"></script>
<script src="{% static 'jsi18n.js' %}"></script>
<script src="{% static 'admin/js/vendor/select2/select2.full.js' %}"></script>
<script src="{% static 'autocomplete_light/autocomplete_light.min.js' %}"></script>
<script src="{% static 'tesseract.min.js' %}"></script>
<script src="{% static 'autocomplete_light/select2.min.js' %}"></script>
<script src="{% static 'autocomplete_light/i18n/en.js' %}"></script>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dexie/3.0.3/dexie.min.js" integrity="sha512-aEtNzq8X5E0ambgeM68H174SOXaANJ6wDqJ0TuVIx4R2J4fRdUA0nLzx0faA1mmViqb+r0VX7cOXkskxyJENUA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5sortable/0.10.0/html5sortable.min.js" integrity="sha512-tBlVMq89XaEC9iU5LyRjP2Vxs8SmVhEHGbv2Co6SbGa14Wsxy2qZN0jadrN+Xn5AifORaUbvZcG21/ExcNfWDA==" crossorigin="anonymous"></script>
<script src="{% static 'tesseract.min.js' %}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.4/toastr.min.js" integrity="sha512-lbwH47l/tPXJYG9AcFNoJaTMhGvYWhVM9YI43CT+uteTRRaiLCui8snIgyAN8XWgNjNhCqlAUdzZptso6OCoFQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="{% static 'js/cornerstone/hammer.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone.min.js' %}"></script>
<script src="{% static 'js/cornerstone/dicomParser.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneMath.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneTools.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneWebImageLoader.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneWADOImageLoader.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone-base64-image-loader.umd.js' %}"></script>
<script src="{% static 'js/anatomy.js' %}" defer="defer" type="module"></script>
{% block js %}
{% endblock %}
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
{% block css %}
{% endblock %}
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<div class="main-nav-header">
{% if request.user.is_authenticated %}
<span id="logout-link" class="top-bar-link">
<a href="{% url 'logout' %}">Logout</a>
</span>
<span id="profile-link" class=" top-bar-link">
<a href="{% url 'profile' %}">Profile</a>
</span>
<span id="rapids-link" class="top-bar-link">
<a href="{% url 'rapids:index' %}">Rapids</a>
</span>
<span id="longs-link" class="top-bar-link">
<a href="{% url 'longs:index' %}">Longs</a>
</span>
<span id="physics-link" class="top-bar-link">
<a href="{% url 'physics:index' %}">Physics</a>
</span>
<span id="anatomy-link" class="top-bar-link">
<a href="{% url 'anatomy:index' %}">Anatomy</a>
</span>
<span id="sbas-link" class="top-bar-link">
<a href="{% url 'sbas:index' %}">SBAs</a>
</span>
<span id="atlas-link" class="top-bar-link">
<a href="{% url 'atlas:index' %}">Atlas</a>
</span>
{% if request.user|has_group:"cid_user_manager" %}
<span id="candidate-link" class="top-bar-link">
<a href="{% url 'generic:manage_cids' %}">Candidates</a>
</span>
{% endif %}
{% endif %}
{% if request.user.is_staff %}
<span id="admin-link" class="top-bar-link">
<a href="{% url 'admin:index' %}">Admin</a>
</span>
{% endif %}
<span id="index-link" class="top-bar-link">
<a href="{% url 'home' %}">Home</a>
</span>
</div>
<div class="content container">
{% block navigation %}
<script src="{% static 'js/cornerstone/hammer.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone.min.js' %}"></script>
<script src="{% static 'js/cornerstone/dicomParser.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneMath.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneTools.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneWebImageLoader.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstoneWADOImageLoader.min.js' %}"></script>
<script src="{% static 'js/cornerstone/cornerstone-base64-image-loader.umd.js' %}"></script>
<script src="{% static 'js/anatomy.js' %}" defer="defer" type="module"></script>
{% block js %}
{% endblock %}
<div class="row clear-both">
<div class="col-md-12">
{% block content %}
{% endblock %}
<link rel="stylesheet" href="{% static 'css/anatomy.css' %}">
{% block css %}
{% endblock %}
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<div class="main-nav-header">
{% if request.user.is_authenticated %}
<span id="logout-link" class="top-bar-link">
<a href="{% url 'logout' %}">Logout</a>
</span>
<span id="profile-link" class=" top-bar-link">
<a href="{% url 'profile' %}">Profile</a>
</span>
<span id="rapids-link" class="top-bar-link">
<a href="{% url 'rapids:index' %}">Rapids</a>
</span>
<span id="longs-link" class="top-bar-link">
<a href="{% url 'longs:index' %}">Longs</a>
</span>
<span id="physics-link" class="top-bar-link">
<a href="{% url 'physics:index' %}">Physics</a>
</span>
<span id="anatomy-link" class="top-bar-link">
<a href="{% url 'anatomy:index' %}">Anatomy</a>
</span>
<span id="sbas-link" class="top-bar-link">
<a href="{% url 'sbas:index' %}">SBAs</a>
</span>
<span id="atlas-link" class="top-bar-link">
<a href="{% url 'atlas:index' %}">Atlas</a>
</span>
{% if request.user|has_group:"cid_user_manager" %}
<span id="candidate-link" class="top-bar-link">
<a href="{% url 'generic:manage_cids' %}">Candidates</a>
</span>
{% endif %}
{% endif %}
{% if request.user.is_staff %}
<span id="admin-link" class="top-bar-link">
<a href="{% url 'admin:index' %}">Admin</a>
</span>
{% endif %}
<span id="index-link" class="top-bar-link">
<a href="{% url 'home' %}">Home</a>
</span>
</div>
<div class="content container">
{% block navigation %}
{% endblock %}
<div class="row clear-both">
<div class="col-md-12">
{% block content %}
{% endblock %}
</div>
</div>
</div>
</div>
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-center">
<a href="/" class="mb-3 me-2 mb-md-0 text-muted text-decoration-none lh-1">
<svg class="bi" width="30" height="24"><use xlink:href="#bootstrap"></use></svg>
</a>
<span class="text-muted">PenraCourses</span>
</div>
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-center">
<a href="/" class="mb-3 me-2 mb-md-0 text-muted text-decoration-none lh-1">
<svg class="bi" width="30" height="24"><use xlink:href="#bootstrap"></use></svg>
</a>
<span class="text-muted">PenraCourses</span>
</div>
<ul class="nav col-md-4 justify-content-end list-unstyled d-flex">
<li class="ms-3"><a class="text-muted" href="{% url 'privacy' %}">Privacy</a></li>
<li class="ms-3"><a class="text-muted" href="{% url 'cookie_consent_cookie_group_list' %}">Cookies</a></li>
</ul>
</footer>
</body>
<ul class="nav col-md-4 justify-content-end list-unstyled d-flex">
<li class="ms-3"><a class="text-muted" href="{% url 'privacy' %}">Privacy</a></li>
<li class="ms-3"><a class="text-muted" href="{% url 'cookie_consent_cookie_group_list' %}">Cookies</a></li>
</ul>
</footer>
</body>
</html>
+5 -1
View File
@@ -1,4 +1,5 @@
{% extends 'base.html' %}
{% load auth_extras %}
{% block content %}
<div class="anatomy">
@@ -54,7 +55,10 @@
<a href="{% url 'password_change'%}">Change password</a>
<a href="{% url 'account_update' user.username %}">Update user details</a>
{% if request.user|has_group:"cid_user_manager" %}
<a href="{% url 'account_update' user.username %}">Update user details</a>
{% endif %}
<a href="{% url 'account_profile_update' user.username %}">Update user profile</a>
</div>
{% endblock %}
+12 -6
View File
@@ -1,11 +1,17 @@
{% extends 'generic/base.html' %}
{% load crispy_forms_tags %}
{% load auth_extras %}
{% block content %}
<h2>Editing user: {{object.username}}</h2>
This form allows you to edit additional user details. Name and emails can be edited <a href="{% url 'account_update' object.username %}">here</a>
<form method="post">{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Update">
</form>
<h2>Editing user: {{object.username}}</h2>
This form allows you to edit additional user details.
{% if request.user|has_group:"cid_user_manager" %}
Name and emails can be edited <a href="{% url 'account_update' object.username %}">here</a>
{% endif %}
<form method="post">{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Update">
</form>
{% endblock %}