mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-08 07:45:32 +01:00
versioning for the tags API
This commit is contained in:
parent
95fe803bf6
commit
d84ca511d4
3 changed files with 59 additions and 3 deletions
|
|
@ -50,6 +50,7 @@ from .parsers import get_parser_class_for_mime_type
|
|||
from .serialisers import (
|
||||
CorrespondentSerializer,
|
||||
DocumentSerializer,
|
||||
TagSerializerVersion1,
|
||||
TagSerializer,
|
||||
DocumentTypeSerializer,
|
||||
PostDocumentSerializer,
|
||||
|
|
@ -118,7 +119,12 @@ class TagViewSet(ModelViewSet):
|
|||
queryset = Tag.objects.annotate(
|
||||
document_count=Count('documents')).order_by(Lower('name'))
|
||||
|
||||
serializer_class = TagSerializer
|
||||
def get_serializer_class(self):
|
||||
if int(self.request.version) == 1:
|
||||
return TagSerializerVersion1
|
||||
else:
|
||||
return TagSerializer
|
||||
|
||||
pagination_class = StandardPagination
|
||||
permission_classes = (IsAuthenticated,)
|
||||
filter_backends = (DjangoFilterBackend, OrderingFilter)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue