mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-07 07:15:07 +01:00
add backend support for saved views
This commit is contained in:
parent
bf9051e44d
commit
dfa1f29809
6 changed files with 152 additions and 5 deletions
|
|
@ -38,7 +38,7 @@ from .filters import (
|
|||
DocumentTypeFilterSet,
|
||||
LogFilterSet
|
||||
)
|
||||
from .models import Correspondent, Document, Log, Tag, DocumentType
|
||||
from .models import Correspondent, Document, Log, Tag, DocumentType, SavedView
|
||||
from .parsers import get_parser_class_for_mime_type
|
||||
from .serialisers import (
|
||||
CorrespondentSerializer,
|
||||
|
|
@ -46,7 +46,8 @@ from .serialisers import (
|
|||
LogSerializer,
|
||||
TagSerializer,
|
||||
DocumentTypeSerializer,
|
||||
PostDocumentSerializer
|
||||
PostDocumentSerializer,
|
||||
SavedViewSerializer
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -240,6 +241,22 @@ class LogViewSet(ReadOnlyModelViewSet):
|
|||
ordering_fields = ("created",)
|
||||
|
||||
|
||||
class SavedViewViewSet(ModelViewSet):
|
||||
model = SavedView
|
||||
|
||||
queryset = SavedView.objects.all()
|
||||
serializer_class = SavedViewSerializer
|
||||
pagination_class = StandardPagination
|
||||
permission_classes = (IsAuthenticated,)
|
||||
|
||||
def get_queryset(self):
|
||||
user = self.request.user
|
||||
return SavedView.objects.filter(user=user)
|
||||
|
||||
def perform_create(self, serializer):
|
||||
serializer.save(user=self.request.user)
|
||||
|
||||
|
||||
class PostDocumentView(APIView):
|
||||
|
||||
permission_classes = (IsAuthenticated,)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue