diff --git a/app/db.sqlite3 b/app/db.sqlite3 index c2af20fe..28211d56 100644 Binary files a/app/db.sqlite3 and b/app/db.sqlite3 differ diff --git a/app/server/api.py b/app/server/api.py index 7ef7e095..f57e8aaa 100644 --- a/app/server/api.py +++ b/app/server/api.py @@ -132,6 +132,12 @@ class AnnotationList(generics.ListCreateAPIView): class AnnotationDetail(generics.RetrieveUpdateDestroyAPIView): permission_classes = (IsAuthenticated, IsProjectUser, IsOwnAnnotation) + def get_serializer_class(self): + project = get_object_or_404(Project, pk=self.kwargs['project_id']) + self.serializer_class = project.get_annotation_serializer() + + return self.serializer_class + def get_queryset(self): document = get_object_or_404(Document, pk=self.kwargs['doc_id']) self.queryset = document.get_annotations() @@ -144,17 +150,3 @@ class AnnotationDetail(generics.RetrieveUpdateDestroyAPIView): self.check_object_permissions(self.request, obj) return obj - - def put(self, request, *args, **kwargs): - doc = get_object_or_404(Document, pk=self.kwargs['doc_id']) - project = get_object_or_404(Project, pk=self.kwargs['project_id']) - self.serializer_class = project.get_annotation_serializer() - if project.is_type_of(Project.Seq2seq): - text = request.data['text'] - annotation = get_object_or_404(Seq2seqAnnotation, pk=request.data['id']) - annotation.text = text - - annotation.save() - serializer = self.serializer_class(annotation) - - return Response(serializer.data)