diff --git a/anatomy/views.py b/anatomy/views.py index 954d5e34..7d543caf 100644 --- a/anatomy/views.py +++ b/anatomy/views.py @@ -323,13 +323,18 @@ def exam_json_edit(request, pk): exam = get_object_or_404(Exam, pk=pk) + if request.POST.get("set_open_access") == "true": + state = True + else: + state = False + questions_changed = [] for q in exam.exam_questions.all(): - q.open_acess = request.POST.get("set_open_access") + q.open_acess = state q.save() questions_changed.append(q.pk) - data = {"status": "success", "questions": json.dumps(questions_changed)} + data = {"status": "success", "questions": questions_changed, "state": state} return JsonResponse(data, status=200) else: data = {"status": "error"}