o
    h                     @   s0   d dl mZmZ dd ZddlmZ dd ZdS )	   )ThemeShopc              
   C   s   d}zt j }|st jjddd}W n ty2 } ztd|  t ddd}W Y d}~nd}~ww ||r9|jnd|r?|jnd|rH| dS ddS )z"Add theme context to all templatesNlightz#2563eb)modeprimary_colorzError in theme_context: z#1d4ed8)theme
theme_moder   secondary_color)	r   objectsfirstcreate	Exceptionprintr   r   get_secondary_color)requestr   e r   0/var/www/html/pos/settings/context_processors.pytheme_context   s$   

r       )r   c                 C   s   z-|   dd }dddddd}||d}tjj|d}|r,||j| |dW S W n
 tjy7   Y nw d dd|   dd dS )	N:r   r   )zhyperkthika.posapp.co.kezshop.hyperkenyaltd.comzhyperkenyaltd.com	localhostz	127.0.0.1)id)shop	shop_nameshop_logo_urlcurrent_domainz	Your Shopz/static/images/default_logo.png)get_hostsplitgetr   r
   nameget_logo_urlDoesNotExist)r   domaindomain_shop_mappingshop_idr   r   r   r   shop_details   s2   r&   N)modelsr   r   r   settings.modelsr&   r   r   r   r   <module>   s    