This commit is contained in:
Ross
2021-11-21 20:39:08 +00:00
parent 8f50dabb5a
commit 2bdc41278c
4 changed files with 44 additions and 0 deletions
+15
View File
@@ -33,6 +33,7 @@ from .forms import (
from .models import (
Rapid,
Abnormality,
RapidImage,
Region,
Examination,
Exam,
@@ -1105,3 +1106,17 @@ def question_save_annotation(request, pk):
class ExamClone(ExamCloneMixin, ExamCreate):
"""Clone exam view"""
@login_required
def get_question_by_hash(request, pk):
if request.is_ajax() and request.method == "POST":
hash = json.loads(request.POST.get("hash"))
try:
question = RapidImage.objects.get(image_md5_hash=hash)
data = {"status": "success", "id": question.pk}
return JsonResponse(data, status=200)
except RapidImage.DoesNotExist:
data = {"status": "success", "id": False}
return JsonResponse(data, status=200)