
    9i                     \    d dl mZmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d
dZd Zd	 Zy)    )parse_qsurlparse
urlunparse)get_template)	force_str)	urlencode)	mark_safeNc                 :    t        |       } | j                  |      S )z;Return rendered template file, with given context as input.)r   render)templatecontexts     N/var/www/apihucms/venv/lib/python3.12/site-packages/django_bootstrap5/utils.pyrender_template_filer   	   s    H%H??7##    c                    t        t        |             }t        |j                        }|||= n|||<   t	        t        |j                  |j                  |j                  |j                  t        |d      |j                  g            S )z!Replace a GET parameter in a URL.T)doseq)r   r   r   queryr	   r   schemenetlocpathparamsr   fragment)urlnamevalueurl_componentsr   s        r   url_replace_paramr      s    in-Nn**+F}4Lt%%%%##%%&-''		
 r   c                 |    i }t        | t              rd| i} |j                  |        |j                  d      ||<   |S )z
    Return dictionary with attributes for HTML tag, updated with key `attr_name` with value `url`.

    Parameter `url` is either a string or a dict of attrs with the key `url`.
    Parameter `attr_key` is the name for the url value in the results.
    r   )
isinstancestrupdatepop)r   	attr_name	url_attrss      r   get_url_attrsr%   (   sC     I#sclS$==/Iir   )N)urllib.parser   r   r   django.template.loaderr   django.utils.encodingr   django.utils.httpr   django.utils.safestringr	   r   r   r%    r   r   <module>r,      s&    7 7 / + ' -$2r   