From 69c7140911e1b142cbc125215fc62273f52e4758 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Wed, 10 Oct 2018 02:26:51 +0200 Subject: [PATCH] [Printer] History jobs in API --- api/urls.py | 3 ++- api/views.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/api/urls.py b/api/urls.py index 785d49f7..497e7d68 100644 --- a/api/urls.py +++ b/api/urls.py @@ -120,7 +120,8 @@ router.register_view(r'dns/reverse-zones', views.DNSReverseZonesView), router.register_view(r'mailing/standard', views.StandardMailingView), router.register_view(r'mailing/club', views.ClubMailingView), # PRINTER -router.register_viewset(r'printer/jobs', views.JobsView) +router.register_viewset(r'printer/printable-jobs', views.PrintableJobsView) +router.register_viewset(r'printer/history-jobs', views.HistoryJobsView) # TOKEN AUTHENTICATION router.register_view(r'token-auth', views.ObtainExpiringAuthToken) diff --git a/api/views.py b/api/views.py index f94d6eaf..7a68b896 100644 --- a/api/views.py +++ b/api/views.py @@ -673,12 +673,18 @@ class ClubMailingView(generics.ListAPIView): serializer_class = serializers.MailingSerializer # PRINTER -class JobsView(viewsets.ModelViewSet): +class PrintableJobsView(viewsets.ModelViewSet): """Api Root Jobs """ queryset = printer.JobWithOptions.objects.filter(status='Printable') serializer_class = serializers.PrintJobSerializer +class HistoryJobsView(viewsets.ModelViewSet): + """Api Root Jobs + """ + queryset = printer.JobWithOptions.objects.exclude(status='Printable').exclude(status='Pending') + serializer_class = serializers.PrintJobSerializer + # TOKEN AUTHENTICATION