more improvements ot image annotatiotns

This commit is contained in:
Ross
2020-12-06 12:19:58 +00:00
parent be80d78d7a
commit 3265285327
7 changed files with 137 additions and 10 deletions
+16
View File
@@ -474,6 +474,21 @@ def active_exams(request):
return JsonResponse(active_exams)
def question_save_annotation(request, pk):
if request.is_ajax() and request.method=='POST':
question = get_object_or_404(AnatomyQuestion, pk=pk)
question.image_annotations = request.POST.get("annotation")
print(question.image_annotations)
question.save()
data = {'status':'success'}
return JsonResponse(data, status=200)
else:
data = {'status':'error'}
return JsonResponse(data, status=400)
def exam_json(request, pk):
exam = get_object_or_404(Exam, pk=pk)
@@ -497,6 +512,7 @@ def exam_json(request, pk):
"title": "{}".format(q.description),
"question": str(q.question_type),
"images": [image_as_base64(q.image)],
"annotations": [q.image_annotations],
"type": "anatomy",
}