From 062b28c8713df2554b623a52e000de0d41dea8e8 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 10 Dec 2019 23:07:25 -0400 Subject: [PATCH] Add the ID and the URL to the checkout serializer Signed-off-by: Roberto Rosario --- HISTORY.rst | 1 + mayan/apps/checkouts/serializers.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index f892866b19..5520f52b9c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,7 @@ automatically. - Use TemplateField for the web link template. - Use TemplateField for smart links. +- Add the ID and the URL to the checkout serializer. 3.3.4 (2019-12-09) ================== diff --git a/mayan/apps/checkouts/serializers.py b/mayan/apps/checkouts/serializers.py index b3df78d150..8ca3911efc 100644 --- a/mayan/apps/checkouts/serializers.py +++ b/mayan/apps/checkouts/serializers.py @@ -16,7 +16,12 @@ class DocumentCheckoutSerializer(serializers.ModelSerializer): document = DocumentSerializer() class Meta: - fields = ('document',) + extra_kwargs = { + 'url': { + 'view_name': 'rest_api:checkedout-document-view' + }, + } + fields = ('document', 'id', 'url') model = DocumentCheckout @@ -32,7 +37,7 @@ class NewDocumentCheckoutSerializer(serializers.ModelSerializer): class Meta: fields = ( 'block_new_version', 'document', 'document_pk', - 'expiration_datetime', 'id' + 'expiration_datetime', 'id', ) model = DocumentCheckout read_only_fields = ('document',)