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',)