
    [6g                     ^    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dS )    )parse_qsurlparse
urlunparse)get_template)	force_str)	urlencode)	mark_safeNc                 J    t          |           } |                     |          S )z;Return rendered template file, with given context as input.)r   render)templatecontexts     V/var/www/surfInsights/venv3-11/lib/python3.11/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.NT)doseq)r   r   r   queryr	   r   schemenetlocpathparamsr   fragment)urlnamevalueurl_componentsr   s        r   url_replace_paramr      s    inn--Nn*++F}4LLt%%#%&---'		
 		
  r   c                     i }t          | t                    rd| i} |                    |            |                    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%   (   sT     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 7 7 7 7 7 7 7 7 / / / / / / + + + + + + ' ' ' ' ' ' - - - - - -$ $ $ $  2    r   