]> git.parisson.com Git - pdfannotator.git/commitdiff
Merge branch 'master' of git.pilotsystems.net:probarreau/pdfannotator
authorYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 15 Jul 2020 13:10:36 +0000 (15:10 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 15 Jul 2020 13:10:36 +0000 (15:10 +0200)
1  2 
models.py
views.py

diff --cc models.py
Simple merge
diff --cc views.py
index 491492fed4949ce11524b35ca27f6ad1092b4757,3c58e7f5966733fc22ac1bfc4e34ff6ff553af66..12d43be79004f915cf7e8037b4e6f63f4434303a
+++ 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()