From c0fb102b83027159336f8718ef0e1072ecfbd7ab Mon Sep 17 00:00:00 2001 From: Ross Date: Sun, 3 Jan 2021 16:59:11 +0000 Subject: [PATCH] . --- anatomy/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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"}