mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-28 15:42:25 +00:00
[Api/printer] API endpoints for printer
This commit is contained in:
parent
d3d64c62fb
commit
909c378c3f
3 changed files with 26 additions and 10 deletions
|
@ -719,12 +719,28 @@ class EMailAddressSerializer(NamespacedHMSerializer):
|
||||||
|
|
||||||
# PRINTER
|
# PRINTER
|
||||||
|
|
||||||
class PrintJobSerializer(NamespacedHMSerializer):
|
class PrintableJobSerializer(NamespacedHMSerializer):
|
||||||
"""Serialize the jobs for printer
|
"""Serialize the jobs to be printed
|
||||||
"""
|
"""
|
||||||
|
file = serializers.FileField(use_url=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = printer.JobWithOptions
|
model = printer.JobWithOptions
|
||||||
exclude = ('price', 'pages')
|
exclude = ('price', 'pages')
|
||||||
|
extra_kwargs = {
|
||||||
|
'api_url': {'view_name': 'printablejobs-detail'}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryJobSerializer(NamespacedHMSerializer):
|
||||||
|
"""Serialize past, cancelled jobs
|
||||||
|
"""
|
||||||
|
file = serializers.FileField(use_url=False)
|
||||||
|
class Meta:
|
||||||
|
model = printer.JobWithOptions
|
||||||
|
exclude = ('price', 'pages')
|
||||||
|
extra_kwargs = {
|
||||||
|
'api_url': {'view_name': 'historyjobs-detail'}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# SERVICE REGEN
|
# SERVICE REGEN
|
||||||
|
|
|
@ -120,8 +120,8 @@ router.register_view(r'dns/reverse-zones', views.DNSReverseZonesView),
|
||||||
router.register_view(r'mailing/standard', views.StandardMailingView),
|
router.register_view(r'mailing/standard', views.StandardMailingView),
|
||||||
router.register_view(r'mailing/club', views.ClubMailingView),
|
router.register_view(r'mailing/club', views.ClubMailingView),
|
||||||
# PRINTER
|
# PRINTER
|
||||||
router.register_viewset(r'printer/printable-jobs', views.PrintableJobsView)
|
router.register_viewset(r'printer/printable-jobs', views.PrintableJobsViewSet, 'printablejobs')
|
||||||
router.register_viewset(r'printer/history-jobs', views.HistoryJobsView)
|
router.register_viewset(r'printer/history-jobs', views.HistoryJobsViewSet, 'historyjobs')
|
||||||
# TOKEN AUTHENTICATION
|
# TOKEN AUTHENTICATION
|
||||||
router.register_view(r'token-auth', views.ObtainExpiringAuthToken)
|
router.register_view(r'token-auth', views.ObtainExpiringAuthToken)
|
||||||
|
|
||||||
|
|
12
api/views.py
12
api/views.py
|
@ -673,17 +673,17 @@ class ClubMailingView(generics.ListAPIView):
|
||||||
serializer_class = serializers.MailingSerializer
|
serializer_class = serializers.MailingSerializer
|
||||||
|
|
||||||
# PRINTER
|
# PRINTER
|
||||||
class PrintableJobsView(viewsets.ModelViewSet):
|
class PrintableJobsViewSet(viewsets.ModelViewSet):
|
||||||
"""Api Root Jobs
|
"""Exposes list of printable jobs
|
||||||
"""
|
"""
|
||||||
queryset = printer.JobWithOptions.objects.filter(status='Printable')
|
queryset = printer.JobWithOptions.objects.filter(status='Printable')
|
||||||
serializer_class = serializers.PrintJobSerializer
|
serializer_class = serializers.PrintableJobSerializer
|
||||||
|
|
||||||
class HistoryJobsView(viewsets.ModelViewSet):
|
class HistoryJobsViewSet(viewsets.ModelViewSet):
|
||||||
"""Api Root Jobs
|
"""Exposes past jobs
|
||||||
"""
|
"""
|
||||||
queryset = printer.JobWithOptions.objects.exclude(status='Printable').exclude(status='Pending')
|
queryset = printer.JobWithOptions.objects.exclude(status='Printable').exclude(status='Pending')
|
||||||
serializer_class = serializers.PrintJobSerializer
|
serializer_class = serializers.HistoryJobSerializer
|
||||||
|
|
||||||
|
|
||||||
# TOKEN AUTHENTICATION
|
# TOKEN AUTHENTICATION
|
||||||
|
|
Loading…
Reference in a new issue