Add an option to edit the author of cases/collections
This commit is contained in:
@@ -51,6 +51,8 @@ from autocomplete import widgets as htmx_widgets
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from generic.forms import ExamAuthorFormMixin
|
||||||
|
|
||||||
class ConditionForm(ModelForm):
|
class ConditionForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Condition
|
model = Condition
|
||||||
@@ -626,3 +628,12 @@ class ConditionAutocompleteForm(Form):
|
|||||||
condition = ModelChoiceField(queryset=Condition.objects.all(), widget=htmx_widgets.Autocomplete(
|
condition = ModelChoiceField(queryset=Condition.objects.all(), widget=htmx_widgets.Autocomplete(
|
||||||
name="conditions", options=dict(model=Condition)
|
name="conditions", options=dict(model=Condition)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
class CaseCollectionAuthorForm(ExamAuthorFormMixin):
|
||||||
|
class Meta(ExamAuthorFormMixin.Meta):
|
||||||
|
model = CaseCollection
|
||||||
|
|
||||||
|
class CaseAuthorForm(ExamAuthorFormMixin):
|
||||||
|
class Meta(ExamAuthorFormMixin.Meta):
|
||||||
|
model = Case
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<a href="#"
|
<a href="#"
|
||||||
onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=case.pk %}')"> Add
|
onclick="return window.create_popup_window('{% url 'feedback_create' question_type='atlas' pk=case.pk %}')"> Add
|
||||||
Note</a>
|
Note</a>
|
||||||
|
<a href="{% url 'atlas:case_authors' case.pk %}" title="Edit Authors">Authors</a>
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<a href="{% url 'admin:atlas_case_change' case.id %}" title="Edit the Case using the admin interface">Admin Edit</a>
|
<a href="{% url 'admin:atlas_case_change' case.id %}" title="Edit the Case using the admin interface">Admin Edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
<a href="{% url 'atlas:collection_mark_overview' collection.pk %}">Mark</a> /
|
<a href="{% url 'atlas:collection_mark_overview' collection.pk %}">Mark</a> /
|
||||||
<a href="{% url 'atlas:collection_scores_cid' collection.pk %}">Scores</a> /
|
<a href="{% url 'atlas:collection_scores_cid' collection.pk %}">Scores</a> /
|
||||||
<a href="{% url 'atlas:exam_cids' collection.pk %}">Candidates</a> /
|
<a href="{% url 'atlas:exam_cids' collection.pk %}">Candidates</a> /
|
||||||
<a href="{% url 'atlas:atlas_create_exam' pk=collection.pk %}">Add New Case</a>
|
<a href="{% url 'atlas:atlas_create_exam' pk=collection.pk %}">Add New Case</a> /
|
||||||
|
<a href="{% url 'atlas:collection_authors' collection.pk %}" title="Edit Authors">Authors</a>
|
||||||
<div class="floating-header">
|
<div class="floating-header">
|
||||||
<a href="{% url 'atlas:exam_update' collection.id %}" title="Edit the Collection">Edit</a>
|
<a href="{% url 'atlas:exam_update' collection.id %}" title="Edit the Collection">Edit</a>
|
||||||
\ <a href="{% url 'atlas:exam_deleted' collection.id %}" title="Delete the Collection">Delete</a>
|
\ <a href="{% url 'atlas:exam_deleted' collection.id %}" title="Delete the Collection">Delete</a>
|
||||||
\ <a href="{% url 'atlas:exam_clone' collection.id %}" title="Clone the Collection">Clone</a>
|
\ <a href="{% url 'atlas:exam_clone' collection.id %}" title="Clone the Collection">Clone</a>
|
||||||
|
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
\ <a href="{% url 'admin:atlas_casecollection_change' collection.id %}" title="Edit the Collection using the admin interface">Admin Edit</a>
|
\ <a href="{% url 'admin:atlas_casecollection_change' collection.id %}" title="Edit the Collection using the admin interface">Admin Edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ urlpatterns = [
|
|||||||
views.collection_take_start,
|
views.collection_take_start,
|
||||||
name="collection_take_start",
|
name="collection_take_start",
|
||||||
),
|
),
|
||||||
|
path("collection/<int:pk>/authors", views.CaseCollectionAuthorUpdate.as_view(), name="collection_authors"),
|
||||||
path(
|
path(
|
||||||
"collection/<int:exam_id>/cids",
|
"collection/<int:exam_id>/cids",
|
||||||
views.GenericExamViews.exam_cids,
|
views.GenericExamViews.exam_cids,
|
||||||
@@ -153,6 +154,7 @@ urlpatterns = [
|
|||||||
views.collection_dicom_json,
|
views.collection_dicom_json,
|
||||||
name="collection_dicom_json",
|
name="collection_dicom_json",
|
||||||
),
|
),
|
||||||
|
path("case/<int:pk>/authors", views.CaseAuthorUpdate.as_view(), name="case_authors"),
|
||||||
path(
|
path(
|
||||||
"case/<int:pk>/dicom_json",
|
"case/<int:pk>/dicom_json",
|
||||||
views.case_dicom_json,
|
views.case_dicom_json,
|
||||||
|
|||||||
+13
-1
@@ -34,6 +34,8 @@ from generic.models import CidUser, CidUserExam
|
|||||||
|
|
||||||
from .forms import (
|
from .forms import (
|
||||||
AddCollectionToCaseForm,
|
AddCollectionToCaseForm,
|
||||||
|
CaseAuthorForm,
|
||||||
|
CaseCollectionAuthorForm,
|
||||||
CaseCollectionCaseFormSet,
|
CaseCollectionCaseFormSet,
|
||||||
CaseCollectionForm,
|
CaseCollectionForm,
|
||||||
CaseForm,
|
CaseForm,
|
||||||
@@ -124,7 +126,7 @@ import logging
|
|||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from django.forms.models import model_to_dict
|
from django.forms.models import model_to_dict
|
||||||
|
|
||||||
from generic.views import ExamCloneMixin, ExamViews, SeriesImagesZipViewBase
|
from generic.views import AuthorRequiredMixin, ExamCloneMixin, ExamViews, SeriesImagesZipViewBase
|
||||||
from reversion.views import RevisionMixin
|
from reversion.views import RevisionMixin
|
||||||
import reversion
|
import reversion
|
||||||
|
|
||||||
@@ -2240,3 +2242,13 @@ def combine_series(request):
|
|||||||
|
|
||||||
return HttpResponse(f"Series {series_ids} combines")
|
return HttpResponse(f"Series {series_ids} combines")
|
||||||
#return HttpResponse("Fail")
|
#return HttpResponse("Fail")
|
||||||
|
|
||||||
|
class CaseCollectionAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
|
||||||
|
model = CaseCollection
|
||||||
|
form_class = CaseCollectionAuthorForm
|
||||||
|
template_name = "author_form.html"
|
||||||
|
|
||||||
|
class CaseAuthorUpdate(RevisionMixin, AuthorRequiredMixin, UpdateView):
|
||||||
|
model = Case
|
||||||
|
form_class = CaseAuthorForm
|
||||||
|
template_name = "author_form.html"
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
{{ form.media }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h2>Edit Authors</h2>
|
||||||
|
<form action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
<input type="submit" value="Submit">
|
||||||
|
<a href="{{ object.get_absolute_url }}" class="btn btn-default">Cancel</a>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user