Fixes for django 4 (remove is_ajax)
This commit is contained in:
+2
-1
@@ -13,7 +13,8 @@ ENV PYTHONUNBUFFERED 1
|
|||||||
# python3 python3-dev gcc \
|
# python3 python3-dev gcc \
|
||||||
# gfortran musl-dev \
|
# gfortran musl-dev \
|
||||||
# libffi-dev openssl-dev
|
# libffi-dev openssl-dev
|
||||||
RUN apt-get update && apt-get -y install postgresql postgresql-contrib
|
RUN apt-get update && apt-get -y install postgresql postgresql-contrib git
|
||||||
|
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
RUN pip install --upgrade pip
|
RUN pip install --upgrade pip
|
||||||
|
|||||||
+4
-4
@@ -634,7 +634,7 @@ def create_body_part(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_body_part_id(request):
|
def get_body_part_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
body_part_name = request.GET["body_part_name"]
|
body_part_name = request.GET["body_part_name"]
|
||||||
body_part_id = BodyPart.objects.get(name=body_part_name).id
|
body_part_id = BodyPart.objects.get(name=body_part_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -660,7 +660,7 @@ def create_examination(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_examination_id(request):
|
def get_examination_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
examination_name = request.GET["examination_name"]
|
examination_name = request.GET["examination_name"]
|
||||||
examination_id = Examination.objects.get(name=examination_name).id
|
examination_id = Examination.objects.get(name=examination_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -686,7 +686,7 @@ def create_structure(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_structure_id(request):
|
def get_structure_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
structure_name = request.GET["structure_name"]
|
structure_name = request.GET["structure_name"]
|
||||||
structure_id = Structure.objects.get(name=structure_name).id
|
structure_id = Structure.objects.get(name=structure_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -718,7 +718,7 @@ class AnatomyQuestionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
|||||||
|
|
||||||
@user_is_author_or_anatomy_checker
|
@user_is_author_or_anatomy_checker
|
||||||
def question_save_annotation(request, pk):
|
def question_save_annotation(request, pk):
|
||||||
if request.is_ajax() and request.method == "POST":
|
if request.method == "POST":
|
||||||
question = get_object_or_404(AnatomyQuestion, pk=pk)
|
question = get_object_or_404(AnatomyQuestion, pk=pk)
|
||||||
|
|
||||||
question.image_annotations = request.POST.get("annotation")
|
question.image_annotations = request.POST.get("annotation")
|
||||||
|
|||||||
+1
-1
@@ -796,7 +796,7 @@ def atlas_scrap(request, pk):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_examination_id(request):
|
def get_examination_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
examination_name = request.GET["examination_name"]
|
examination_name = request.GET["examination_name"]
|
||||||
examination_id = Examination.objects.get(name=examination_name).id
|
examination_id = Examination.objects.get(name=examination_name).id
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
+3
-3
@@ -590,7 +590,7 @@ def create_examination(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_examination_id(request):
|
def get_examination_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
examination_name = request.GET["examination_name"]
|
examination_name = request.GET["examination_name"]
|
||||||
examination_id = Examination.objects.get(name=examination_name).id
|
examination_id = Examination.objects.get(name=examination_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -1210,7 +1210,7 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
|
|||||||
|
|
||||||
@user_passes_test(lambda u: u.is_superuser)
|
@user_passes_test(lambda u: u.is_superuser)
|
||||||
def user_answer_delete_multiple(request):
|
def user_answer_delete_multiple(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
answer_ids = json.loads(request.POST["answer_ids"])
|
answer_ids = json.loads(request.POST["answer_ids"])
|
||||||
|
|
||||||
# We could probably delete them all at once....
|
# 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
|
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)
|
exam = get_object_or_404(Exam, pk=pk)
|
||||||
|
|
||||||
if not exam.publish_results:
|
if not exam.publish_results:
|
||||||
|
|||||||
+4
-4
@@ -281,7 +281,7 @@ def active_exams_unbased(request, cid=None, passcode=None):
|
|||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def exam_submit(request):
|
def exam_submit(request):
|
||||||
print(request)
|
print(request)
|
||||||
if request.is_ajax and request.method == "POST":
|
if request.method == "POST":
|
||||||
print(request.POST)
|
print(request.POST)
|
||||||
exam_type, exam_id = request.POST.get("eid").split("/")
|
exam_type, exam_id = request.POST.get("eid").split("/")
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ def feedback_mark_complete(request, pk):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def answer_suggestion_submit(request):
|
def answer_suggestion_submit(request):
|
||||||
if request.is_ajax and request.method == "POST":
|
if request.method == "POST":
|
||||||
post_data = json.loads(request.body)
|
post_data = json.loads(request.body)
|
||||||
question_type, qid = post_data["qid"].split("/")
|
question_type, qid = post_data["qid"].split("/")
|
||||||
answer_string = post_data["answer"]
|
answer_string = post_data["answer"]
|
||||||
@@ -411,7 +411,7 @@ def answer_suggestion_submit(request):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def answer_submit(request):
|
def answer_submit(request):
|
||||||
if request.is_ajax and request.method == "POST":
|
if request.method == "POST":
|
||||||
qid = request.POST.get("qid")
|
qid = request.POST.get("qid")
|
||||||
question_type = request.POST.get("question_type")
|
question_type = request.POST.get("question_type")
|
||||||
answer_string = request.POST.get("answer")
|
answer_string = request.POST.get("answer")
|
||||||
@@ -442,7 +442,7 @@ def answer_submit(request):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def answer_suggestion_confirm(request):
|
def answer_suggestion_confirm(request):
|
||||||
if request.is_ajax and request.method == "POST":
|
if request.method == "POST":
|
||||||
question_type = request.POST.get("question_type")
|
question_type = request.POST.get("question_type")
|
||||||
aid = request.POST.get("aid")
|
aid = request.POST.get("aid")
|
||||||
status = request.POST.get("status")
|
status = request.POST.get("status")
|
||||||
|
|||||||
+5
-5
@@ -449,7 +449,7 @@ def create_abnormality(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_abnormality_id(request):
|
def get_abnormality_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
abnormality_name = request.GET["abnormality_name"]
|
abnormality_name = request.GET["abnormality_name"]
|
||||||
abnormality_id = Abnormality.objects.get(name=abnormality_name).id
|
abnormality_id = Abnormality.objects.get(name=abnormality_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -475,7 +475,7 @@ def create_examination(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_examination_id(request):
|
def get_examination_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
examination_name = request.GET["examination_name"]
|
examination_name = request.GET["examination_name"]
|
||||||
examination_id = Examination.objects.get(name=examination_name).id
|
examination_id = Examination.objects.get(name=examination_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -501,7 +501,7 @@ def create_region(request):
|
|||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
def get_region_id(request):
|
def get_region_id(request):
|
||||||
if request.is_ajax():
|
if request.accepts("application/json")():
|
||||||
region_name = request.GET["region_name"]
|
region_name = request.GET["region_name"]
|
||||||
region_id = Region.objects.get(name=region_name).id
|
region_id = Region.objects.get(name=region_name).id
|
||||||
data = {
|
data = {
|
||||||
@@ -849,7 +849,7 @@ def question_anonymise_dicom(request, pk):
|
|||||||
|
|
||||||
@user_is_author_or_rapid_checker
|
@user_is_author_or_rapid_checker
|
||||||
def question_save_annotation(request, pk):
|
def question_save_annotation(request, pk):
|
||||||
if request.is_ajax() and request.method == "POST":
|
if request.method == "POST":
|
||||||
question = get_object_or_404(Rapid, pk=pk)
|
question = get_object_or_404(Rapid, pk=pk)
|
||||||
|
|
||||||
image_annotations = json.loads(request.POST.get("annotation"))
|
image_annotations = json.loads(request.POST.get("annotation"))
|
||||||
@@ -877,7 +877,7 @@ class ExamClone(ExamCloneMixin, ExamCreate):
|
|||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def get_question_by_hash(request):
|
def get_question_by_hash(request):
|
||||||
if request.is_ajax() and request.method == "POST":
|
if request.method == "POST":
|
||||||
|
|
||||||
hash = request.POST.get("hash")
|
hash = request.POST.get("hash")
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,4 +1,5 @@
|
|||||||
Django==3.2.13
|
#Django==3.2.13
|
||||||
|
Django==4.1.4
|
||||||
django_debug_toolbar
|
django_debug_toolbar
|
||||||
django_jquery
|
django_jquery
|
||||||
django_reversion
|
django_reversion
|
||||||
@@ -16,7 +17,8 @@ pytesseract
|
|||||||
opencv-python
|
opencv-python
|
||||||
pydicom
|
pydicom
|
||||||
django-dbbackup
|
django-dbbackup
|
||||||
django-hashedfilenamestorage
|
#django-hashedfilenamestorage
|
||||||
|
git+https://github.com/allysonbarros/django-hashedfilenamestorage#egg=django-hashedfilenamestorage
|
||||||
djangorestframework
|
djangorestframework
|
||||||
django-tinymce
|
django-tinymce
|
||||||
django-zipview
|
django-zipview
|
||||||
@@ -31,5 +33,5 @@ rich
|
|||||||
bs4
|
bs4
|
||||||
django-htmx
|
django-htmx
|
||||||
debugpy
|
debugpy
|
||||||
django-cookie-consent
|
git+https://github.com/jazzband/django-cookie-consent#django-cookie-consent
|
||||||
django-crispy-forms
|
django-crispy-forms
|
||||||
@@ -424,7 +424,6 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
|
|||||||
|
|
||||||
# @user_passes_test(lambda u: u.is_superuser)
|
# @user_passes_test(lambda u: u.is_superuser)
|
||||||
# def user_answer_delete_multiple(request):
|
# def user_answer_delete_multiple(request):
|
||||||
# if request.is_ajax():
|
|
||||||
# print(request.POST["answer_ids"])
|
# print(request.POST["answer_ids"])
|
||||||
# answer_ids = json.loads(request.POST["answer_ids"])
|
# answer_ids = json.loads(request.POST["answer_ids"])
|
||||||
#
|
#
|
||||||
@@ -432,7 +431,6 @@ class UserAnswerDelete(SuperuserRequiredMixin, DeleteView):
|
|||||||
# for id in answer_ids:
|
# for id in answer_ids:
|
||||||
# CidUserAnswer.objects.get(pk=id).delete()
|
# CidUserAnswer.objects.get(pk=id).delete()
|
||||||
# return JsonResponse({"status": "success"})
|
# return JsonResponse({"status": "success"})
|
||||||
# return JsonResponse({"status": "error"})
|
|
||||||
|
|
||||||
|
|
||||||
GenericViews = GenericViewBase("sbas", Question, CidUserAnswer, Exam)
|
GenericViews = GenericViewBase("sbas", Question, CidUserAnswer, Exam)
|
||||||
|
|||||||
Reference in New Issue
Block a user