.
This commit is contained in:
@@ -1,11 +1,2 @@
|
|||||||
# serializers.py
|
# serializers.py
|
||||||
from rest_framework import serializers, permissions
|
from rest_framework import serializers, permissions
|
||||||
|
|
||||||
|
|
||||||
from .models import Exam
|
|
||||||
|
|
||||||
class ExamSerializer(serializers.HyperlinkedModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = Exam
|
|
||||||
fields = ('name', 'id', 'active', "publish_results")
|
|
||||||
permission_classes = [permissions.IsAuthenticated]
|
|
||||||
-117
@@ -5,7 +5,6 @@ app_name = "atlas"
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# path('', views.question_list, name='question_list'),
|
# path('', views.question_list, name='question_list'),
|
||||||
path("", views.AtlasExamViews.index, name="index"),
|
|
||||||
path("author/<int:pk>/", views.author_detail, name="author_detail"),
|
path("author/<int:pk>/", views.author_detail, name="author_detail"),
|
||||||
path("author/", views.author_list, name="author_list"),
|
path("author/", views.author_list, name="author_list"),
|
||||||
path("question/", views.CaseView.as_view(), name="atlas_view"),
|
path("question/", views.CaseView.as_view(), name="atlas_view"),
|
||||||
@@ -44,96 +43,11 @@ urlpatterns = [
|
|||||||
# path("unchecked/", views.unchecked_list, name="unchecked_list"),
|
# path("unchecked/", views.unchecked_list, name="unchecked_list"),
|
||||||
# path("verified/<int:pk>/", views.verified_detail, name="verified_detail"),
|
# path("verified/<int:pk>/", views.verified_detail, name="verified_detail"),
|
||||||
path("question/<int:pk>/", views.case_detail, name="case_detail"),
|
path("question/<int:pk>/", views.case_detail, name="case_detail"),
|
||||||
path("question/<int:pk>/json", views.question_json, name="question_json"),
|
|
||||||
path(
|
|
||||||
"question/<int:pk>/json/unbased",
|
|
||||||
views.question_json_unbased,
|
|
||||||
name="question_json_unbased",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"question/<int:pk>/json/recreate",
|
|
||||||
views.question_json_recreate,
|
|
||||||
name="question_json_recreate",
|
|
||||||
),
|
|
||||||
path("question/<int:pk>/split", views.atlas_split, name="atlas_split"),
|
|
||||||
path("question/<int:pk>/clone", views.AtlasClone.as_view(), name="case_clone"),
|
path("question/<int:pk>/clone", views.AtlasClone.as_view(), name="case_clone"),
|
||||||
# path("verified/", views.verified, name="verified"),
|
# path("verified/", views.verified, name="verified"),
|
||||||
# path("all_questions/", views.all_questions, name="all_questions"),
|
# path("all_questions/", views.all_questions, name="all_questions"),
|
||||||
path("question/<int:pk>/scrap", views.atlas_scrap, name="atlas_scrap"),
|
path("question/<int:pk>/scrap", views.atlas_scrap, name="atlas_scrap"),
|
||||||
path("question/<int:pk>/delete", views.AtlasDelete.as_view(), name="atlas_delete"),
|
path("question/<int:pk>/delete", views.AtlasDelete.as_view(), name="atlas_delete"),
|
||||||
path(
|
|
||||||
"exam/<int:pk>/review",
|
|
||||||
views.question_review,
|
|
||||||
name="question_review",
|
|
||||||
),
|
|
||||||
path("exam/<int:exam_id>/<int:question_number>/<int:cid>/mark", views.mark_answer, name="mark_answer"),
|
|
||||||
path("exam/<int:exam_id>/<int:question_number>/<int:cid>/mark_override", views.mark_answer_override, name="mark_answer_override"),
|
|
||||||
path("exam/<int:exam_id>/<int:sk>/mark", views.mark_question_overview, name="mark_question_overview"),
|
|
||||||
path("exam/<int:pk>/mark", views.AtlasExamViews.mark_overview, name="mark_overview"),
|
|
||||||
# path("exam/<int:pk>/<int:sk>/", views.exam_take, name="exam_take"),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/question/<int:sk>/",
|
|
||||||
views.AtlasExamViews.exam_case_detail,
|
|
||||||
name="exam_case_detail",
|
|
||||||
),
|
|
||||||
path("exam/<int:pk>/", views.AtlasExamViews.exam_overview, name="exam_overview"),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/json_edit",
|
|
||||||
views.AtlasExamViews.exam_json_edit,
|
|
||||||
name="exam_json_edit",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/question_json_refresh",
|
|
||||||
views.refresh_exam_question_json,
|
|
||||||
name="refresh_exam_question_json",
|
|
||||||
),
|
|
||||||
path("exam/<int:pk>/scores", views.exam_scores_cid, name="exam_scores_cid"),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/scores/<int:sk>/",
|
|
||||||
views.exam_scores_cid_user,
|
|
||||||
name="exam_scores_cid_user",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/toggle_active",
|
|
||||||
views.AtlasExamViews.exam_toggle_active,
|
|
||||||
name="exam_toggle_active",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/<int:pk>/toggle_results_published",
|
|
||||||
views.AtlasExamViews.exam_toggle_results_published,
|
|
||||||
name="exam_toggle_results_published",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/submit", views.AtlasExamViews.postExamAnswers, name="exam_answers_submit"
|
|
||||||
),
|
|
||||||
path("exam/", views.AtlasExamViews.exam_list, name="exam_list"),
|
|
||||||
path("exam/all", views.AtlasExamViews.exam_list_all, name="exam_list_all"),
|
|
||||||
path("exam/create", views.ExamCreate.as_view(), name="exam_create"),
|
|
||||||
path("exam/<int:exam_id>/clone", views.ExamClone.as_view(), name="exam_clone"),
|
|
||||||
path("exam/<int:pk>/update", views.ExamUpdate.as_view(), name="exam_update"),
|
|
||||||
path("exam/<int:pk>/delete", views.ExamDelete.as_view(), name="exam_delete"),
|
|
||||||
path("exam/json/", views.AtlasExamViews.active_exams, name="active_exams"),
|
|
||||||
path("exam/json/<int:pk>", views.AtlasExamViews.exam_json, name="exam_json"),
|
|
||||||
path(
|
|
||||||
"exam/json/<int:pk>/unbased",
|
|
||||||
views.AtlasExamViews.exam_json_unbased,
|
|
||||||
name="exam_json_unbased",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/json/<int:pk>/<int:sk>",
|
|
||||||
views.AtlasExamViews.exam_question_json,
|
|
||||||
name="exam_question_json",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/json/<int:pk>/unbased/<int:sk>",
|
|
||||||
views.AtlasExamViews.exam_question_json_unbased,
|
|
||||||
name="exam_question_json_unbased",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"exam/json/<int:pk>/recreate",
|
|
||||||
views.AtlasExamViews.exam_json_recreate,
|
|
||||||
name="exam_json_recreate",
|
|
||||||
),
|
|
||||||
path("create/", views.AtlasCreate.as_view(), name="create"),
|
path("create/", views.AtlasCreate.as_view(), name="create"),
|
||||||
path("create/series", views.SeriesCreate.as_view(), name="series_create"),
|
path("create/series", views.SeriesCreate.as_view(), name="series_create"),
|
||||||
path(
|
path(
|
||||||
@@ -141,19 +55,6 @@ urlpatterns = [
|
|||||||
views.SeriesCreate.as_view(),
|
views.SeriesCreate.as_view(),
|
||||||
name="series_id_create",
|
name="series_id_create",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"create/defaults",
|
|
||||||
views.AtlasCreationDefaultView.as_view(),
|
|
||||||
name="create_defaults",
|
|
||||||
),
|
|
||||||
# path("region/create/", views.create_region, name="create_region"),
|
|
||||||
# path("region/ajax/get_region_id", views.get_region_id, name="get_region_id"),
|
|
||||||
# path("abnormality/create/", views.create_abnormality, name="create_abnormality"),
|
|
||||||
# path(
|
|
||||||
# "abnormality/ajax/get_abnormality_id",
|
|
||||||
# views.get_abnormality_id,
|
|
||||||
# name="get_abnormality_id",
|
|
||||||
# ),
|
|
||||||
path("examination/create/", views.create_examination, name="create_examination"),
|
path("examination/create/", views.create_examination, name="create_examination"),
|
||||||
path(
|
path(
|
||||||
"examination/ajax/get_examination_id",
|
"examination/ajax/get_examination_id",
|
||||||
@@ -170,22 +71,4 @@ urlpatterns = [
|
|||||||
views.SeriesUpdate.as_view(),
|
views.SeriesUpdate.as_view(),
|
||||||
name="series_update",
|
name="series_update",
|
||||||
),
|
),
|
||||||
path(
|
|
||||||
"user_answers/",
|
|
||||||
views.UserAnswerTableView.as_view(),
|
|
||||||
name="user_answer_table_view",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"user_answers/<int:pk>", views.UserAnswerView.as_view(), name="user_answer_view"
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"user_answers/<int:pk>/delete",
|
|
||||||
views.UserAnswerDelete.as_view(),
|
|
||||||
name="user_answer_delete",
|
|
||||||
),
|
|
||||||
path(
|
|
||||||
"user_answers/delete",
|
|
||||||
views.user_answer_delete_multiple,
|
|
||||||
name="user_answer_delete_multiple",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|||||||
+10
-14
@@ -65,8 +65,6 @@ from helpers.images import image_as_base64
|
|||||||
import logging
|
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 atlas.forms import AtlasCreationDefaultForm
|
|
||||||
from atlas.models import AtlasCreationDefault
|
|
||||||
|
|
||||||
from generic.views import ExamCloneMixin, ExamViews
|
from generic.views import ExamCloneMixin, ExamViews
|
||||||
from reversion.views import RevisionMixin
|
from reversion.views import RevisionMixin
|
||||||
@@ -75,8 +73,6 @@ import reversion
|
|||||||
|
|
||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
|
|
||||||
from .serializers import ExamSerializer
|
|
||||||
|
|
||||||
from zipview.views import BaseZipView
|
from zipview.views import BaseZipView
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -111,7 +107,7 @@ def case_detail(request, pk):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@user_is_author_or_atlas_series_checker_or_atlas_marker
|
@user_is_author_or_atlas_series_checker_or_atlas_marker
|
||||||
def atlas_series_detail(request, pk):
|
def series_detail(request, pk):
|
||||||
series = get_object_or_404(Series, pk=pk)
|
series = get_object_or_404(Series, pk=pk)
|
||||||
|
|
||||||
# if request.user not in atlas.author.all():
|
# if request.user not in atlas.author.all():
|
||||||
@@ -468,7 +464,7 @@ def get_examination_id(request):
|
|||||||
return HttpResponse("/")
|
return HttpResponse("/")
|
||||||
|
|
||||||
|
|
||||||
class AtlasView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
class CaseView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = Case
|
model = Case
|
||||||
table_class = AtlasTable
|
table_class = AtlasTable
|
||||||
template_name = "atlas/view.html"
|
template_name = "atlas/view.html"
|
||||||
@@ -486,19 +482,19 @@ class SeriesView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@user_is_author_or_atlas_series_checker
|
@user_is_author_or_atlas_series_checker
|
||||||
def atlas_series_order_dicom(request, pk):
|
def series_order_dicom(request, pk):
|
||||||
series = get_object_or_404(Series, pk=pk)
|
series = get_object_or_404(Series, pk=pk)
|
||||||
try:
|
try:
|
||||||
series.order_by_dicom()
|
series.order_by_dicom()
|
||||||
except:
|
except:
|
||||||
return HttpResponse("<h1>Series does not appear to contain dicoms</h1>")
|
return HttpResponse("<h1>Series does not appear to contain dicoms</h1>")
|
||||||
|
|
||||||
return redirect("atlas:atlas_series_detail", pk=pk)
|
return redirect("atlas:series_detail", pk=pk)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@user_is_author_or_atlas_series_checker
|
@user_is_author_or_atlas_series_checker
|
||||||
def atlas_series_order_dicom_instance(request, pk):
|
def series_order_dicom_instance(request, pk):
|
||||||
series = get_object_or_404(Series, pk=pk)
|
series = get_object_or_404(Series, pk=pk)
|
||||||
try:
|
try:
|
||||||
series.order_by_dicom("InstanceNumber")
|
series.order_by_dicom("InstanceNumber")
|
||||||
@@ -507,12 +503,12 @@ def atlas_series_order_dicom_instance(request, pk):
|
|||||||
"<h1>Series does not appear to contain dicoms (or field InstanceNumber)</h1>"
|
"<h1>Series does not appear to contain dicoms (or field InstanceNumber)</h1>"
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect("atlas:atlas_series_detail", pk=pk)
|
return redirect("atlas:series_detail", pk=pk)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@user_is_author_or_atlas_series_checker
|
@user_is_author_or_atlas_series_checker
|
||||||
def atlas_series_order_dicom_SeriesInstanceUID(request, pk):
|
def series_order_dicom_SeriesInstanceUID(request, pk):
|
||||||
series = get_object_or_404(Series, pk=pk)
|
series = get_object_or_404(Series, pk=pk)
|
||||||
try:
|
try:
|
||||||
series.order_by_dicom("SeriesInstanceUID")
|
series.order_by_dicom("SeriesInstanceUID")
|
||||||
@@ -521,16 +517,16 @@ def atlas_series_order_dicom_SeriesInstanceUID(request, pk):
|
|||||||
"<h1>Series does not appear to contain dicoms (or field SeriesInstanceUID)</h1>"
|
"<h1>Series does not appear to contain dicoms (or field SeriesInstanceUID)</h1>"
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect("atlas:atlas_series_detail", pk=pk)
|
return redirect("atlas:series_detail", pk=pk)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@user_is_author_or_atlas_series_checker
|
@user_is_author_or_atlas_series_checker
|
||||||
def atlas_series_order_upload_filename(request, pk):
|
def series_order_upload_filename(request, pk):
|
||||||
series = get_object_or_404(Series, pk=pk)
|
series = get_object_or_404(Series, pk=pk)
|
||||||
series.order_by_upload_filename()
|
series.order_by_upload_filename()
|
||||||
|
|
||||||
return redirect("atlas:atlas_series_detail", pk=pk)
|
return redirect("atlas:series_detail", pk=pk)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user