unify generic exam views naming
This commit is contained in:
+18
-18
@@ -8,7 +8,7 @@ app_name = "anatomy"
|
||||
|
||||
urlpatterns = [
|
||||
# path('', views.question_list, name='question_list'),
|
||||
path("", views.AnatomyExamViews.index, name="index"),
|
||||
path("", views.GenericExamViews.index, name="index"),
|
||||
path(
|
||||
"question/",
|
||||
views.AnatomyQuestionView.as_view(),
|
||||
@@ -62,29 +62,29 @@ urlpatterns = [
|
||||
"exam/<int:exam_pk>/<int:sk>/mark/review", views.mark_review, name="mark_review"
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/mark", views.AnatomyExamViews.mark_overview, name="mark_overview"
|
||||
"exam/<int:pk>/mark", views.GenericExamViews.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.AnatomyExamViews.exam_question_detail,
|
||||
views.GenericExamViews.exam_question_detail,
|
||||
name="exam_question_detail",
|
||||
),
|
||||
path("exam/<int:pk>/", views.AnatomyExamViews.exam_overview, name="exam_overview"),
|
||||
path("exam/<int:pk>/", views.GenericExamViews.exam_overview, name="exam_overview"),
|
||||
path(
|
||||
"exam/<int:pk>/json_edit",
|
||||
views.AnatomyExamViews.exam_json_edit,
|
||||
views.GenericExamViews.exam_json_edit,
|
||||
name="exam_json_edit",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/scores",
|
||||
views.AnatomyExamViews.exam_scores_cid,
|
||||
views.GenericExamViews.exam_scores_cid,
|
||||
# cache_page(60 * 1)(views.exam_scores_cid),
|
||||
name="exam_scores_cid",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/scores/refresh",
|
||||
views.AnatomyExamViews.exam_scores_refresh,
|
||||
views.GenericExamViews.exam_scores_refresh,
|
||||
# cache_page(60 * 1)(views.exam_scores_cid),
|
||||
name="exam_scores_refresh",
|
||||
),
|
||||
@@ -95,41 +95,41 @@ urlpatterns = [
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/toggle_active",
|
||||
views.AnatomyExamViews.exam_toggle_active,
|
||||
views.GenericExamViews.exam_toggle_active,
|
||||
name="exam_toggle_active",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/toggle_results_published",
|
||||
views.AnatomyExamViews.exam_toggle_results_published,
|
||||
views.GenericExamViews.exam_toggle_results_published,
|
||||
name="exam_toggle_results_published",
|
||||
),
|
||||
path(
|
||||
"exam/submit",
|
||||
views.AnatomyExamViews.postExamAnswers,
|
||||
views.GenericExamViews.postExamAnswers,
|
||||
name="exam_answers_submit",
|
||||
),
|
||||
path("exam/", views.AnatomyExamViews.exam_list, name="exam_list"),
|
||||
path("exam/all", views.AnatomyExamViews.exam_list_all, name="exam_list_all"),
|
||||
path("exam/", views.GenericExamViews.exam_list, name="exam_list"),
|
||||
path("exam/all", views.GenericExamViews.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:exam_id>/cids", views.AnatomyExamViews.exam_cids, name="exam_cids"),
|
||||
path("exam/<int:exam_id>/cids", views.GenericExamViews.exam_cids, name="exam_cids"),
|
||||
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.AnatomyExamViews.active_exams, name="active_exams"),
|
||||
path("exam/json/<int:pk>", views.AnatomyExamViews.exam_json, name="exam_json"),
|
||||
path("exam/json/", views.GenericExamViews.active_exams, name="active_exams"),
|
||||
path("exam/json/<int:pk>", views.GenericExamViews.exam_json, name="exam_json"),
|
||||
path(
|
||||
"exam/json/<int:pk>/unbased",
|
||||
views.AnatomyExamViews.exam_json_unbased,
|
||||
views.GenericExamViews.exam_json_unbased,
|
||||
name="exam_json_unbased",
|
||||
),
|
||||
path(
|
||||
"exam/json/<int:pk>/<int:sk>/unbased",
|
||||
views.AnatomyExamViews.exam_question_json_unbased,
|
||||
views.GenericExamViews.exam_question_json_unbased,
|
||||
name="exam_question_json_unbased",
|
||||
),
|
||||
path(
|
||||
"exam/json/<int:pk>/recreate",
|
||||
views.AnatomyExamViews.exam_json_recreate,
|
||||
views.GenericExamViews.exam_json_recreate,
|
||||
name="exam_json_recreate",
|
||||
),
|
||||
# path("cid/", views.cid_selector, name="cid_selector"),
|
||||
|
||||
+12
-10
@@ -136,8 +136,8 @@ def answer_question(request, pk):
|
||||
)
|
||||
|
||||
|
||||
#@login_required
|
||||
#def exam_take(request, pk, sk):
|
||||
# @login_required
|
||||
# def exam_take(request, pk, sk):
|
||||
# """
|
||||
# Allows taking of the exam on the django server (when logged in)
|
||||
#
|
||||
@@ -212,7 +212,7 @@ def answer_question(request, pk):
|
||||
# )
|
||||
|
||||
|
||||
#def flag_question(request):
|
||||
# def flag_question(request):
|
||||
# pk = request.GET.get("pk", None)
|
||||
# ans = UserAnswer.objects.filter(user=request.user, question__pk=pk).first()
|
||||
# ans.flagged = not ans.flagged
|
||||
@@ -244,7 +244,9 @@ def loadJsonAnswer(answer):
|
||||
exam = get_object_or_404(Exam, pk=eid)
|
||||
|
||||
if not exam.check_cid_user(answer["cid"], answer["passcode"]):
|
||||
return False, JsonResponse({"success": False, "error": "invalid cid / passcode"})
|
||||
return False, JsonResponse(
|
||||
{"success": False, "error": "invalid cid / passcode"}
|
||||
)
|
||||
|
||||
# if not exam.active:
|
||||
# return False, JsonResponse(
|
||||
@@ -452,6 +454,7 @@ def mark(request, exam_pk, sk, unmarked_exam_answers_only=True, review=False):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
def exam_scores_refresh(request, pk):
|
||||
exam = get_object_or_404(Exam, pk=pk)
|
||||
@@ -461,9 +464,7 @@ def exam_scores_refresh(request, pk):
|
||||
|
||||
questions = exam.exam_questions.all()
|
||||
|
||||
cids = (
|
||||
CidUserAnswer.objects.filter(question__in=questions, exam__id=pk)
|
||||
)
|
||||
cids = CidUserAnswer.objects.filter(question__in=questions, exam__id=pk)
|
||||
|
||||
# Force a score update
|
||||
for c in cids:
|
||||
@@ -477,8 +478,9 @@ def exam_scores_refresh(request, pk):
|
||||
},
|
||||
)
|
||||
|
||||
#@login_required
|
||||
#def exam_scores_cid(request, pk):
|
||||
|
||||
# @login_required
|
||||
# def exam_scores_cid(request, pk):
|
||||
# exam = get_object_or_404(Exam, pk=pk)
|
||||
#
|
||||
# if not exam.exam_mode:
|
||||
@@ -1001,7 +1003,7 @@ def question_save_annotation(request, pk):
|
||||
return JsonResponse(data, status=400)
|
||||
|
||||
|
||||
AnatomyExamViews = ExamViews(
|
||||
GenericExamViews = ExamViews(
|
||||
Exam, AnatomyQuestion, CidUserAnswer, "anatomy", "anatomy", loadJsonAnswer
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user