if is_readonly(request):
raise PermissionDenied
data = json.loads(request.body.decode('utf-8'))
- id = data['commentId']
- comment = AnnotationComment.objects.get(id)
- annot = comment.annotation
- comment.delete()
- annot.delete()
- return HttpResponse(json.dumps({'status': 'ok'}), content_type="application/json")
+ annotation_id = data['annotationId']
+ uuid = data['fileUuid']
+ comment = AnnotationComment.objects.get(annotation_id=annotation_id, uuid=uuid)
+ comment.content = data['comment']
+ comment.save()
+ return HttpResponse(json.dumps({'status':'ok'}), content_type="application/json")
+
+ # def delete_comment(request):
+ # if is_readonly(request):
+ # raise PermissionDenied
+ # data = json.loads(request.body.decode('utf-8'))
+ # id = data['commentId']
+ # comment = AnnotationComment.objects.get(id)
+ # annot = comment.annotation
+ # comment.delete()
+ # annot.delete()
+ # return HttpResponse(json.dumps({'status': 'ok'}), content_type="application/json")
+@login_required
def get_comments(request):
uuid = request.GET.get('fileUuid')
# import pdb;pdb.set_trace()