o
    [h                     @   s   d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZ e jd	d
 ZG dd dZG dd dZG dd deeZG dd deeZG dd deZG dd deZG dd deZdS )    N)Path)settings)DjangoTemplatesget_template)RemovedInDjango60Warning)cached_property)import_stringc                  C   s   t tj} |  S N)r	   r   ZFORM_RENDERER)Zrenderer_class r   }/home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/venv/lib/python3.10/site-packages/django/forms/renderers.pyget_default_renderer   s   
r   c                   @   s.   e Zd ZdZdZdZdZdd Zd	ddZdS )
BaseRendererzdjango/forms/div.htmlzdjango/forms/formsets/div.htmlzdjango/forms/field.htmlNc                 C   s   t d)Nz(subclasses must implement get_template())NotImplementedErrorselftemplate_namer   r   r   r         zBaseRenderer.get_templatec                 C   s   |  |}|j||d S )N)request)r   renderstrip)r   r   contextr   templater   r   r   r      s   
zBaseRenderer.renderr
   )	__name__
__module____qualname__Zform_template_nameZformset_template_nameZfield_template_nameZbound_field_classr   r   r   r   r   r   r      s    r   c                   @   s    e Zd Zdd Zedd ZdS )EngineMixinc                 C   s   | j |S r
   )enginer   r   r   r   r   r   #   s   zEngineMixin.get_templatec                 C   s$   |  dttj| j j gdi dS )NTZdjangoforms)ZAPP_DIRSZDIRSNAMEOPTIONS)backendr   __file__parentZapp_dirname)r   r   r   r   r   &   s   zEngineMixin.engineN)r   r   r   r   r   r   r   r   r   r   r   "   s    r   c                   @   s   e Zd ZdZeZdS )r   z
    Load Django templates from the built-in widget templates in
    django/forms/templates and from apps' 'templates' directory.
    N)r   r   r   __doc__r   r    r   r   r   r   r   2   s    r   c                   @   s   e Zd ZdZedd ZdS )Jinja2
    Load Jinja2 templates from the built-in widget templates in
    django/forms/jinja2 and from apps' 'jinja2' directory.
    c                 C   s   ddl m} |S )Nr   )r$   )Zdjango.template.backends.jinja2r$   )r   r$   r   r   r   r    A   s   zJinja2.backendN)r   r   r   r#   r   r    r   r   r   r   r$   ;   s    r$   c                           e Zd ZdZ fddZ  ZS )DjangoDivFormRendererz
    Load Django templates from django/forms/templates and from apps'
    'templates' directory and use the 'div.html' template to render forms and
    formsets.
    c                    &   t jdtdd t j|i | d S )Nz`The DjangoDivFormRenderer transitional form renderer is deprecated. Use DjangoTemplates instead.   
stacklevelwarningswarnr   super__init__r   argskwargs	__class__r   r   r0   P      zDjangoDivFormRenderer.__init__r   r   r   r#   r0   __classcell__r   r   r4   r   r'   I   s    r'   c                       r&   )Jinja2DivFormRendererr%   c                    r(   )NzWThe Jinja2DivFormRenderer transitional form renderer is deprecated. Use Jinja2 instead.r)   r*   r,   r1   r4   r   r   r0   a   r6   zJinja2DivFormRenderer.__init__r7   r   r   r4   r   r9   [   s    r9   c                   @   s   e Zd ZdZdd ZdS )TemplatesSettingzr
    Load templates using template.loader.get_template() which is configured
    based on settings.TEMPLATES.
    c                 C   s   t |S r
   r   r   r   r   r   r   q   r   zTemplatesSetting.get_templateN)r   r   r   r#   r   r   r   r   r   r:   k   s    r:   )	functoolsr-   pathlibr   Zdjango.confr   Zdjango.template.backends.djangor   Zdjango.template.loaderr   Zdjango.utils.deprecationr   Zdjango.utils.functionalr   Zdjango.utils.module_loadingr	   	lru_cacher   r   r   r$   r'   r9   r:   r   r   r   r   <module>   s$    
	