.
This commit is contained in:
+4
-3
@@ -321,9 +321,10 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
preserved = Case(*[When(pk=pk, then=pos) for pos, pk in enumerate(new_order)])
|
||||
objects = self.Question.objects.filter(pk__in=new_order).order_by(preserved)
|
||||
|
||||
if len(objects) != exam.exam_questions.count():
|
||||
data = {"status": "error, count does not match"}
|
||||
return JsonResponse(data, status=400)
|
||||
# We now allow deleting exam questions
|
||||
#if len(objects) != exam.exam_questions.count():
|
||||
# data = {"status": "error, count does not match"}
|
||||
# return JsonResponse(data, status=400)
|
||||
|
||||
exam.exam_questions.set(objects)
|
||||
exam.save()
|
||||
|
||||
Reference in New Issue
Block a user