From: Yoan Le Clanche Date: Wed, 15 Jul 2020 13:10:36 +0000 (+0200) Subject: Merge branch 'master' of git.pilotsystems.net:probarreau/pdfannotator X-Git-Tag: v1.1.0~12 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b30b4eec48cea616aa7255a308d267b0fff32b88;p=pdfannotator.git Merge branch 'master' of git.pilotsystems.net:probarreau/pdfannotator --- b30b4eec48cea616aa7255a308d267b0fff32b88 diff --cc views.py index 491492f,3c58e7f..12d43be --- a/views.py +++ b/views.py @@@ -134,14 -130,24 +133,25 @@@ def update_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") + 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()