.
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)])
|
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)
|
objects = self.Question.objects.filter(pk__in=new_order).order_by(preserved)
|
||||||
|
|
||||||
if len(objects) != exam.exam_questions.count():
|
# We now allow deleting exam questions
|
||||||
data = {"status": "error, count does not match"}
|
#if len(objects) != exam.exam_questions.count():
|
||||||
return JsonResponse(data, status=400)
|
# data = {"status": "error, count does not match"}
|
||||||
|
# return JsonResponse(data, status=400)
|
||||||
|
|
||||||
exam.exam_questions.set(objects)
|
exam.exam_questions.set(objects)
|
||||||
exam.save()
|
exam.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user