From 720f0d4f00db270bb4aef72fb7089d63801718ef Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 11 Jun 2021 14:15:35 +0900 Subject: [PATCH] Change AutoLabelingAnnotation API url --- backend/api/urls.py | 2 +- backend/api/views/auto_labeling.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/api/urls.py b/backend/api/urls.py index ce91d9fc..a0443cd3 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -175,7 +175,7 @@ urlpatterns_project = [ name='auto_labeling_config_test' ), path( - route='docs//auto-labeling', + route='examples//auto-labeling', view=views.AutoLabelingAnnotation.as_view(), name='auto_labeling_annotation' ), diff --git a/backend/api/views/auto_labeling.py b/backend/api/views/auto_labeling.py index 06a8d43e..4ba560dd 100644 --- a/backend/api/views/auto_labeling.py +++ b/backend/api/views/auto_labeling.py @@ -203,7 +203,7 @@ class AutoLabelingAnnotation(generics.CreateAPIView): def get_queryset(self): project = get_object_or_404(Project, pk=self.kwargs['project_id']) model = project.get_annotation_class() - queryset = model.objects.filter(example=self.kwargs['doc_id']) + queryset = model.objects.filter(example=self.kwargs['example_id']) if not project.collaborative_annotation: queryset = queryset.filter(user=self.request.user) return queryset @@ -224,7 +224,7 @@ class AutoLabelingAnnotation(generics.CreateAPIView): serializer.save(user=self.request.user) def get_example(self, project): - example = get_object_or_404(Example, pk=self.kwargs['doc_id']) + example = get_object_or_404(Example, pk=self.kwargs['example_id']) if project.is_task_of('text'): return example.text else: @@ -248,7 +248,7 @@ class AutoLabelingAnnotation(generics.CreateAPIView): def transform(self, labels): project = get_object_or_404(Project, pk=self.kwargs['project_id']) for label in labels: - label['example'] = self.kwargs['doc_id'] + label['example'] = self.kwargs['example_id'] if 'label' in label: label['label'] = project.labels.get(text=label.pop('label')).id return labels