.
This commit is contained in:
+7
-2
@@ -323,13 +323,18 @@ def exam_json_edit(request, pk):
|
|||||||
|
|
||||||
exam = get_object_or_404(Exam, pk=pk)
|
exam = get_object_or_404(Exam, pk=pk)
|
||||||
|
|
||||||
|
if request.POST.get("set_open_access") == "true":
|
||||||
|
state = True
|
||||||
|
else:
|
||||||
|
state = False
|
||||||
|
|
||||||
questions_changed = []
|
questions_changed = []
|
||||||
for q in exam.exam_questions.all():
|
for q in exam.exam_questions.all():
|
||||||
q.open_acess = request.POST.get("set_open_access")
|
q.open_acess = state
|
||||||
q.save()
|
q.save()
|
||||||
questions_changed.append(q.pk)
|
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)
|
return JsonResponse(data, status=200)
|
||||||
else:
|
else:
|
||||||
data = {"status": "error"}
|
data = {"status": "error"}
|
||||||
|
|||||||
Reference in New Issue
Block a user