Moves where the mail views live and puts the ordering on those

This commit is contained in:
Trenton Holmes 2022-12-04 16:33:07 -08:00
parent ce9f604d81
commit 049dc17902
2 changed files with 2 additions and 40 deletions

View File

@ -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)

View File

@ -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,)