Fixes for django 4 (remove is_ajax)

This commit is contained in:
Ross
2022-12-19 10:24:51 +00:00
parent ac0032da52
commit 9fc457c8a5
8 changed files with 24 additions and 23 deletions
+3 -3
View File
@@ -590,7 +590,7 @@ def create_examination(request):
@csrf_exempt
def get_examination_id(request):
if request.is_ajax():
if request.accepts("application/json")():
examination_name = request.GET["examination_name"]
examination_id = Examination.objects.get(name=examination_name).id
data = {
@@ -1210,7 +1210,7 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
@user_passes_test(lambda u: u.is_superuser)
def user_answer_delete_multiple(request):
if request.is_ajax():
if request.accepts("application/json")():
answer_ids = json.loads(request.POST["answer_ids"])
# We could probably delete them all at once....
@@ -1244,7 +1244,7 @@ def question_review(request, pk):
"""
Return a json representation of the question when the exam is active
"""
if request.is_ajax():
if request.accepts("application/json")():
exam = get_object_or_404(Exam, pk=pk)
if not exam.publish_results: