From 361da6bce9cc339a0b1e0f459d88546b926a20ca Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Tue, 2 Oct 2018 02:53:00 +0200 Subject: [PATCH] [api] Serializer for printer job. Beginning, it's late --- api/serializers.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/serializers.py b/api/serializers.py index 53f695e4..18d44c50 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -22,6 +22,8 @@ """Defines the serializers of the API """ +from re2o.settings import INSTALLED_APPS + from rest_framework import serializers import cotisations.models as cotisations @@ -30,6 +32,10 @@ import preferences.models as preferences import topologie.models as topologie import users.models as users +if "printer" in INSTALLED_APPS: + import printer.models as printer + + # The namespace used for the API. It must match the namespace used in the # urlpatterns to include the API URLs. API_NAMESPACE = 'api' @@ -711,6 +717,16 @@ class EMailAddressSerializer(NamespacedHMSerializer): model = users.EMailAddress fields = ('user', 'local_part', 'complete_email_address', 'api_url') +# PRINTER + +class PrintJobSerializer(NamespacedHMSerializer): + """Serialize the jobs for printer + """ + class Meta: + model = printer.JobWithOptions + fields = ('file', 'filename', 'status', 'starttime', 'endtime', 'api_url') + + # SERVICE REGEN