.
This commit is contained in:
+6
-8
@@ -197,10 +197,9 @@ class AddQuestionNote(CreateView):
|
||||
@csrf_exempt
|
||||
def answer_suggestion_submit(request):
|
||||
if request.is_ajax and request.method == "POST":
|
||||
j = json.loads(request.body.decode())
|
||||
question_type, qid = j["qid"].split("/")
|
||||
answer_string = j["answer"]
|
||||
status = j["status"]
|
||||
question_type, qid = request.POST.get("qid").split("/")
|
||||
answer_string = request.POST.get("answer")
|
||||
status = request.POST.get("status")
|
||||
|
||||
if str(status) not in " 012":
|
||||
return JsonResponse({"success": False, "error": "Invalid status"})
|
||||
@@ -229,9 +228,8 @@ def answer_suggestion_submit(request):
|
||||
@login_required
|
||||
def answer_suggestion_confirm(request):
|
||||
if request.is_ajax and request.method == "POST":
|
||||
j = json.loads(request.body.decode())
|
||||
question_type = j["question_type"]
|
||||
aid = j["aid"]
|
||||
question_type = request.POST.get("question_type")
|
||||
aid = request.POST.get("aid")
|
||||
|
||||
if question_type == "anatomy":
|
||||
AnswerModel = AnatomyAnswer
|
||||
@@ -242,7 +240,7 @@ def answer_suggestion_confirm(request):
|
||||
else:
|
||||
return JsonResponse({"success": False, "error": "Invalid question type"})
|
||||
|
||||
answer = get_object_or_404(AnswerModel, pk=qid)
|
||||
answer = get_object_or_404(AnswerModel, pk=aid)
|
||||
answer.proposed = False
|
||||
answer.save()
|
||||
return JsonResponse({"success": True, "error": "Answer changed"})
|
||||
|
||||
Reference in New Issue
Block a user