Browse Source

Rename RelationSerializer

pull/1652/head
Hironsan 2 years ago
parent
commit
a7ce45142f
2 changed files with 4 additions and 4 deletions
  1. 2
      backend/labels/serializers.py
  2. 6
      backend/labels/views.py

2
backend/labels/serializers.py

@ -59,7 +59,7 @@ class TextLabelSerializer(serializers.ModelSerializer):
read_only_fields = ('user',)
class AnnotationRelationsSerializer(serializers.ModelSerializer):
class RelationSerializer(serializers.ModelSerializer):
def validate(self, attrs):
return super().validate(attrs)

6
backend/labels/views.py

@ -10,7 +10,7 @@ from api.models import Project
from labels.models import Category, Span, TextLabel, AnnotationRelations
from members.permissions import IsInProjectOrAdmin, IsInProjectReadOnlyOrAdmin
from .permissions import CanEditAnnotation
from .serializers import CategorySerializer, SpanSerializer, TextLabelSerializer, AnnotationRelationsSerializer
from .serializers import CategorySerializer, SpanSerializer, TextLabelSerializer, RelationSerializer
class BaseListAPI(generics.ListCreateAPIView):
@ -100,7 +100,7 @@ class TextLabelDetailAPI(BaseDetailAPI):
class RelationList(generics.ListCreateAPIView):
serializer_class = AnnotationRelationsSerializer
serializer_class = RelationSerializer
pagination_class = None
permission_classes = [IsAuthenticated & IsInProjectReadOnlyOrAdmin]
@ -120,6 +120,6 @@ class RelationList(generics.ListCreateAPIView):
class RelationDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = AnnotationRelations.objects.all()
serializer_class = AnnotationRelationsSerializer
serializer_class = RelationSerializer
lookup_url_kwarg = 'annotation_relation_id'
permission_classes = [IsAuthenticated & IsInProjectReadOnlyOrAdmin]
Loading…
Cancel
Save