This commit is contained in:
Ross
2021-01-28 10:58:10 +00:00
parent 5e77160bbf
commit a2864d0755
3 changed files with 36 additions and 24 deletions
+12 -3
View File
@@ -27,8 +27,8 @@ from physics.models import Exam as PhysicsExam
from anatomy.models import CidUserAnswer as AnatomyCidUserAnswer
from anatomy.models import Exam as AnatomyExam
from anatomy.views import active_exams as active_anatomy_exams
from rapids.views import active_exams as active_rapid_exams
from anatomy.views import active_exams as active_anatomy_exams, postExamAnswers as postAnatomyExamAnswers
from rapids.views import active_exams as active_rapid_exams, postExamAnswers as postRapidExamAnswers
@@ -94,5 +94,14 @@ def active_exams(request):
@csrf_exempt
def exam_submit(request):
if request.is_ajax and request.method == "POST":
exam_type, exam_id = request.POST.get("eid").split("/")
if exam_type == "anatomy":
return postAnatomyExamAnswers(request)
elif exam_type == "rapid":
return postRapidExamAnswers(request)
return JsonResponse({"success": False, "error": "Invalid exam type"})
# postExamAnswers
pass
return JsonResponse({"success": False, "error": "Invalid data"})