diff --git a/app/server/api.py b/app/server/api.py index 4f9372be..dbebe659 100644 --- a/app/server/api.py +++ b/app/server/api.py @@ -9,7 +9,7 @@ from rest_framework.permissions import IsAuthenticated, IsAdminUser from rest_framework.response import Response from rest_framework.views import APIView -from .models import Project, Label, Document, DocumentAnnotation, SequenceAnnotation, Seq2seqAnnotation +from .models import Project, Label, Document, Seq2seqAnnotation from .permissions import IsAdminUserAndWriteOnly, IsProjectUser, IsOwnAnnotation from .serializers import ProjectSerializer, LabelSerializer, TextSerializer @@ -132,7 +132,7 @@ class DocumentList(generics.ListCreateAPIView): return queryset -class AnnotationsAPI(generics.ListCreateAPIView): +class AnnotationList(generics.ListCreateAPIView): pagination_class = None permission_classes = (IsAuthenticated, IsProjectUser) @@ -155,7 +155,7 @@ class AnnotationsAPI(generics.ListCreateAPIView): serializer.save(document=doc, user=self.request.user) -class AnnotationAPI(generics.RetrieveUpdateDestroyAPIView): +class AnnotationDetail(generics.RetrieveUpdateDestroyAPIView): permission_classes = (IsAuthenticated, IsProjectUser, IsOwnAnnotation) def get_queryset(self): diff --git a/app/server/urls.py b/app/server/urls.py index c5d8de4b..38946d7d 100644 --- a/app/server/urls.py +++ b/app/server/urls.py @@ -5,7 +5,7 @@ from .views import IndexView from .views import ProjectView, DatasetView, DataUpload, LabelView, StatsView from .views import ProjectsView, DataDownload from .api import ProjectViewSet, LabelList, ProjectStatsAPI, LabelDetail, ProjectDocsAPI, \ - AnnotationsAPI, AnnotationAPI, DocumentList + AnnotationList, AnnotationDetail, DocumentList router = routers.DefaultRouter() router.register(r'projects', ProjectViewSet) @@ -18,8 +18,8 @@ urlpatterns = [ path('api/projects//labels/', LabelDetail.as_view(), name='label'), path('api/projects//docs/', ProjectDocsAPI.as_view(), name='docs'), path('api/projects//texts/', DocumentList.as_view(), name='texts'), - path('api/projects//docs//annotations/', AnnotationsAPI.as_view(), name='annotations'), - path('api/projects//docs//annotations/', AnnotationAPI.as_view(), name='ann'), + path('api/projects//docs//annotations/', AnnotationList.as_view(), name='annotations'), + path('api/projects//docs//annotations/', AnnotationDetail.as_view(), name='ann'), path('projects/', ProjectsView.as_view(), name='projects'), path('projects//download', DataDownload.as_view(), name='download'), path('projects//', ProjectView.as_view(), name='annotation'),