From 049dc17902c11456323e3a68327963dfd3cd5f1c Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Sun, 4 Dec 2022 16:33:07 -0800 Subject: [PATCH] Moves where the mail views live and puts the ordering on those --- src/documents/views.py | 38 ------------------------------------- src/paperless_mail/views.py | 4 ++-- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/documents/views.py b/src/documents/views.py index 3b2075e25..10225be6f 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -33,10 +33,6 @@ from packaging import version as packaging_version from paperless import version from paperless.db import GnuPG from paperless.views import StandardPagination -from paperless_mail.models import MailAccount -from paperless_mail.models import MailRule -from paperless_mail.serialisers import MailAccountSerializer -from paperless_mail.serialisers import MailRuleSerializer from rest_framework import parsers from rest_framework.decorators import action from rest_framework.exceptions import NotFound @@ -914,37 +910,3 @@ class AcknowledgeTasksView(GenericAPIView): return Response({"result": result}) except Exception: return HttpResponseBadRequest() - - -class MailAccountViewSet(ModelViewSet): - model = MailAccount - - queryset = MailAccount.objects.all().order_by("pk") - serializer_class = MailAccountSerializer - pagination_class = StandardPagination - permission_classes = (IsAuthenticated,) - - # TODO: user-scoped - # def get_queryset(self): - # user = self.request.user - # return MailAccount.objects.filter(user=user) - - # def perform_create(self, serializer): - # serializer.save(user=self.request.user) - - -class MailRuleViewSet(ModelViewSet): - model = MailRule - - queryset = MailRule.objects.all().order_by("pk") - serializer_class = MailRuleSerializer - pagination_class = StandardPagination - permission_classes = (IsAuthenticated,) - - # TODO: user-scoped - # def get_queryset(self): - # user = self.request.user - # return MailRule.objects.filter(user=user) - - # def perform_create(self, serializer): - # serializer.save(user=self.request.user) diff --git a/src/paperless_mail/views.py b/src/paperless_mail/views.py index b91487f1f..d86240c7c 100644 --- a/src/paperless_mail/views.py +++ b/src/paperless_mail/views.py @@ -10,7 +10,7 @@ from rest_framework.viewsets import ModelViewSet class MailAccountViewSet(ModelViewSet): model = MailAccount - queryset = MailAccount.objects.all() + queryset = MailAccount.objects.all().order_by("pk") serializer_class = MailAccountSerializer pagination_class = StandardPagination permission_classes = (IsAuthenticated,) @@ -27,7 +27,7 @@ class MailAccountViewSet(ModelViewSet): class MailRuleViewSet(ModelViewSet): model = MailRule - queryset = MailRule.objects.all() + queryset = MailRule.objects.all().order_by("pk") serializer_class = MailRuleSerializer pagination_class = StandardPagination permission_classes = (IsAuthenticated,)