mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-16 00:13:12 +00:00
[Printer/Api] Serialize abstract printoperation model
This commit is contained in:
parent
4b530750f4
commit
6c903b371c
3 changed files with 18 additions and 1 deletions
|
@ -719,6 +719,15 @@ class EMailAddressSerializer(NamespacedHMSerializer):
|
|||
|
||||
# PRINTER
|
||||
|
||||
class PrintOperationSerializer(NamespacedHMSerializer):
|
||||
"""Serialiaze abstract print operation
|
||||
"""
|
||||
class Meta:
|
||||
model = printer.PrintOperation
|
||||
extra_kwargs = {
|
||||
'api_url' : {'view_name': 'printoperation-detail'}
|
||||
}
|
||||
|
||||
class PrintableJobSerializer(NamespacedHMSerializer):
|
||||
"""Serialize the jobs to be printed
|
||||
"""
|
||||
|
|
|
@ -122,6 +122,7 @@ router.register_view(r'mailing/club', views.ClubMailingView),
|
|||
# PRINTER
|
||||
router.register_viewset(r'printer/printable-jobs', views.PrintableJobsViewSet, 'printablejobs')
|
||||
router.register_viewset(r'printer/history-jobs', views.HistoryJobsViewSet, 'historyjobs')
|
||||
router.register_viewset(r'printer/printoperation', views.PrintOperationViewSet, 'printoperation')
|
||||
# TOKEN AUTHENTICATION
|
||||
router.register_view(r'token-auth', views.ObtainExpiringAuthToken)
|
||||
|
||||
|
|
|
@ -673,6 +673,13 @@ class ClubMailingView(generics.ListAPIView):
|
|||
serializer_class = serializers.MailingSerializer
|
||||
|
||||
# PRINTER
|
||||
class PrintOperationViewSet(viewsets.ModelViewSet):
|
||||
"""Exposes list of printoperations
|
||||
"""
|
||||
queryset = printer.PrintOperation.objects.all()
|
||||
serializer_class = serializers.PrintOperationSerializer
|
||||
|
||||
|
||||
class PrintableJobsViewSet(viewsets.ModelViewSet):
|
||||
"""Exposes list of printable jobs
|
||||
"""
|
||||
|
@ -685,7 +692,7 @@ class HistoryJobsViewSet(viewsets.ModelViewSet):
|
|||
queryset = printer.JobWithOptions.objects.exclude(status='Printable').exclude(status='Pending')
|
||||
serializer_class = serializers.HistoryJobSerializer
|
||||
|
||||
|
||||
|
||||
# TOKEN AUTHENTICATION
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue