This commit is contained in:
Ross
2021-01-03 16:59:11 +00:00
parent b8023445fa
commit c0fb102b83
+7 -2
View File
@@ -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"}