Merge remote-tracking branch 'origin/master' into feature/merge_master
This commit is contained in:
@@ -31,7 +31,9 @@ from .serializers import (
|
||||
DeletedDocumentSerializer, DocumentPageSerializer, DocumentSerializer,
|
||||
DocumentTypeSerializer, DocumentVersionSerializer,
|
||||
DocumentVersionRevertSerializer, NewDocumentSerializer,
|
||||
NewDocumentVersionSerializer, RecentDocumentSerializer
|
||||
NewDocumentVersionSerializer, RecentDocumentSerializer,
|
||||
WritableDocumentSerializer, WritableDocumentTypeSerializer,
|
||||
WritableDocumentVersionSerializer
|
||||
)
|
||||
from .tasks import task_generate_document_page_image
|
||||
|
||||
@@ -187,7 +189,6 @@ class APIDocumentView(generics.RetrieveUpdateDestroyAPIView):
|
||||
}
|
||||
permission_classes = (MayanPermission,)
|
||||
queryset = Document.objects.all()
|
||||
serializer_class = DocumentSerializer
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
"""
|
||||
@@ -203,6 +204,12 @@ class APIDocumentView(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
return super(APIDocumentView, self).get(*args, **kwargs)
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.request.method == 'GET':
|
||||
return DocumentSerializer
|
||||
else:
|
||||
return WritableDocumentSerializer
|
||||
|
||||
def patch(self, *args, **kwargs):
|
||||
"""
|
||||
Edit the properties of the selected document.
|
||||
@@ -321,6 +328,12 @@ class APIDocumentTypeListView(generics.ListCreateAPIView):
|
||||
|
||||
return super(APIDocumentTypeListView, self).get(*args, **kwargs)
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.request.method == 'GET':
|
||||
return DocumentTypeSerializer
|
||||
else:
|
||||
return WritableDocumentTypeSerializer
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
"""
|
||||
Create a new document type.
|
||||
@@ -342,7 +355,6 @@ class APIDocumentTypeView(generics.RetrieveUpdateDestroyAPIView):
|
||||
}
|
||||
permission_classes = (MayanPermission,)
|
||||
queryset = DocumentType.objects.all()
|
||||
serializer_class = DocumentTypeSerializer
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
"""
|
||||
@@ -358,6 +370,12 @@ class APIDocumentTypeView(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
return super(APIDocumentTypeView, self).get(*args, **kwargs)
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.request.method == 'GET':
|
||||
return DocumentTypeSerializer
|
||||
else:
|
||||
return WritableDocumentTypeSerializer
|
||||
|
||||
def patch(self, *args, **kwargs):
|
||||
"""
|
||||
Edit the properties of the selected document type.
|
||||
@@ -463,7 +481,12 @@ class APIDocumentVersionView(generics.RetrieveUpdateAPIView):
|
||||
mayan_permission_attribute_check = 'document'
|
||||
permission_classes = (MayanPermission,)
|
||||
queryset = DocumentVersion.objects.all()
|
||||
serializer_class = DocumentVersionSerializer
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.request.method == 'GET':
|
||||
return DocumentVersionSerializer
|
||||
else:
|
||||
return WritableDocumentVersionSerializer
|
||||
|
||||
def patch(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user