mirror of https://github.com/doccano/doccano.git
pythondatasetnatural-language-processingdata-labelingmachine-learningannotation-tooldatasetsactive-learningtext-annotation
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
552 B
18 lines
552 B
from ...models import Category
|
|
from ...serializers import CategorySerializer
|
|
from .base import BaseDetailAPI, BaseListAPI
|
|
|
|
|
|
class CategoryListAPI(BaseListAPI):
|
|
annotation_class = Category
|
|
serializer_class = CategorySerializer
|
|
|
|
def create(self, request, *args, **kwargs):
|
|
if self.project.single_class_classification:
|
|
self.get_queryset().delete()
|
|
return super().create(request, args, kwargs)
|
|
|
|
|
|
class CategoryDetailAPI(BaseDetailAPI):
|
|
queryset = Category.objects.all()
|
|
serializer_class = CategorySerializer
|