a
    Dg                     @   s>   d dl mZ d dlmZ d dlmZ dZG dd dejZ	dS )    )settings)models)gettext_lazy))videoZVideo)ZphotoZPhoto)linkLink)ZrichZRichc                   @   s   e Zd ZdZe ZejdddZej	ddddZ
ej	dedZejddZejddZejddZejddZejddZejdddZejdddZejdd	Zejdddd
ZG dd dZedd Zedd Zedd Zdd ZdS )Embeda  
    When embed code is fetched from a provider (eg, youtube) we cache that code
    in the database so we don't need to ask for it again.

    This model is used for caching the embed html code. It also stores some
    metadata which gets displayed in the editor.

    If an instance of this model is deleted, it will be automatically refetched
    next time the embed code is needed.
    T)nullblank    )
max_lengthuniquedb_index
   )r   choices)r
   )Zauto_now)r	   r
   r   c                   @   s   e Zd ZedZedZdS )z
Embed.MetaembedZembedsN)__name__
__module____qualname___Zverbose_nameZverbose_name_plural r   r   T/var/www/lab.imftr.de/x/nb_venv/lib/python3.9/site-packages/wagtail/embeds/models.pyMeta'   s   r   c                 C   s   | j r| jr| j| j  S d S N)widthheightselfr   r   r   ratio+   s    zEmbed.ratioc                 C   s   | j }|rt|d d S d S )Nd   %)r   str)r   r   r   r   r   	ratio_css0   s    zEmbed.ratio_cssc                 C   s   t tddsdS | jd uS )NZWAGTAILEMBEDS_RESPONSIVE_HTMLF)getattrr   r   r   r   r   r   is_responsive6   s    zEmbed.is_responsivec                 C   s   | j S r   )urlr   r   r   r   __str__<   s    zEmbed.__str__N)r   r   r   __doc__r   Z	TextFieldr%   ZSmallIntegerField	max_widthZ	CharFieldhashEMBED_TYPEStypehtmltitleZauthor_nameZprovider_nameZthumbnail_urlZIntegerFieldr   r   ZDateTimeFieldZlast_updatedZcache_untilr   propertyr   r"   r$   r&   r   r   r   r   r      s,   


r   N)
Zdjango.confr   Z	django.dbr   Zdjango.utils.translationr   r   r*   ZModelr   r   r   r   r   <module>   s   