o
    hk                     @   sH   d dl mZ d dlmZ d dlmZ G dd deZG dd deZdS )	    )Field)BaseSerializer)get_full_urlc                   @   s    e Zd ZdZdd Zdd ZdS )DocumentDownloadUrlFieldz
    Serializes the "download_url" field for documents.

    Example:
    "download_url": "http://api.example.com/documents/1/my_document.pdf"
    c                 C   s   |S )N )selfinstancer   r   d/var/www/html/ndineBlogger/venv/lib/python3.10/site-packages/wagtail/documents/api/v2/serializers.pyget_attribute   s   z&DocumentDownloadUrlField.get_attributec                 C   s   t | jd |jS )Nrequest)r   contexturl)r   documentr   r   r	   to_representation   s   z*DocumentDownloadUrlField.to_representationN)__name__
__module____qualname____doc__r
   r   r   r   r   r	   r      s    r   c                   @   s   e Zd ZeddZdS )DocumentSerializerT)	read_onlyN)r   r   r   r   download_urlr   r   r   r	   r      s    r   N)rest_framework.fieldsr   wagtail.api.v2.serializersr   wagtail.api.v2.utilsr   r   r   r   r   r   r	   <module>   s
    