8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-28 15:42:25 +00:00

[Printer/Api] Serialize abstract printoperation model

This commit is contained in:
Maxime Bombar 2018-10-26 01:26:47 +02:00 committed by root
parent 4b530750f4
commit 6c903b371c
3 changed files with 18 additions and 1 deletions

View file

@ -719,6 +719,15 @@ class EMailAddressSerializer(NamespacedHMSerializer):
# PRINTER # PRINTER
class PrintOperationSerializer(NamespacedHMSerializer):
"""Serialiaze abstract print operation
"""
class Meta:
model = printer.PrintOperation
extra_kwargs = {
'api_url' : {'view_name': 'printoperation-detail'}
}
class PrintableJobSerializer(NamespacedHMSerializer): class PrintableJobSerializer(NamespacedHMSerializer):
"""Serialize the jobs to be printed """Serialize the jobs to be printed
""" """

View file

@ -122,6 +122,7 @@ router.register_view(r'mailing/club', views.ClubMailingView),
# PRINTER # PRINTER
router.register_viewset(r'printer/printable-jobs', views.PrintableJobsViewSet, 'printablejobs') 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/history-jobs', views.HistoryJobsViewSet, 'historyjobs')
router.register_viewset(r'printer/printoperation', views.PrintOperationViewSet, 'printoperation')
# TOKEN AUTHENTICATION # TOKEN AUTHENTICATION
router.register_view(r'token-auth', views.ObtainExpiringAuthToken) router.register_view(r'token-auth', views.ObtainExpiringAuthToken)

View file

@ -673,6 +673,13 @@ class ClubMailingView(generics.ListAPIView):
serializer_class = serializers.MailingSerializer serializer_class = serializers.MailingSerializer
# PRINTER # PRINTER
class PrintOperationViewSet(viewsets.ModelViewSet):
"""Exposes list of printoperations
"""
queryset = printer.PrintOperation.objects.all()
serializer_class = serializers.PrintOperationSerializer
class PrintableJobsViewSet(viewsets.ModelViewSet): class PrintableJobsViewSet(viewsets.ModelViewSet):
"""Exposes list of printable jobs """Exposes list of printable jobs
""" """