U
    |h                     @   sD   d dl mZ d dlmZ d dlmZ d dlmZ G dd deZdS )    )warn)Widget)	mark_safe)RemovedInWagtail70Warningc                       sB   e Zd Zeded  fddZdd Zddd	Zd
d Z  Z	S )WidgetWithScriptzQThe usage of `WidgetWithScript` hook is deprecated. Use external scripts instead.)categoryc                    s   t  |||S )z4Render the HTML (non-JS) portion of the field markup)superrender)selfnamevalueattrs	__class__ ]/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/utils/widgets.pyrender_html   s    zWidgetWithScript.render_htmlc                 C   s   |S )Nr   )r
   r   r   r   r   get_value_data   s    zWidgetWithScript.get_value_dataNc           
   	   C   sl   z|d }W n  t tfk
r,   tdY nX | |}| |||}| |||}| d| d}	t|	S )Nidz=WidgetWithScript cannot be rendered without an 'id' attributez<script>z	</script>)KeyError	TypeErrorr   r   render_js_initr   )
r
   r   r   r   rendererid_Z
value_dataZwidget_htmljsoutr   r   r   r	      s    

zWidgetWithScript.renderc                 C   s   dS )N r   )r
   r   r   r   r   r   r   r   ,   s    zWidgetWithScript.render_js_init)NN)
__name__
__module____qualname__r   r   r   r   r	   r   __classcell__r   r   r   r   r   	   s   
r   N)	warningsr   Zdjango.forms.widgetsr   Zdjango.utils.safestringr   Zwagtail.utils.deprecationr   r   r   r   r   r   <module>   s   