
œõ^S  ã               @   sb   d  d l  m Z d  d l m Z m Z d  d l m Z d  d l m Z d d „  Z	 d d „  Z
 d	 S)
é    )ÚUser)ÚAdminÚNotifications)ÚCustomer)ÚDriverModelc             C   s}   d } |  j  j d ƒ rm |  j  d } t j j d | ƒ j ƒ  } | rm t j j d | d d d d ƒ j ƒ  } d t | ƒ i S)	Nr   ÚemailÚuserÚstatusÚunreadÚdeletedFÚunread_notifications_count)	ÚsessionÚhas_keyr   ÚobjectsÚfilterÚfirstr   ÚcountÚstr)Úrequestr   Ú	email_valÚuser_obj© r   úV/home/development/Documents/Good_Delivery/GoodsDelivery/Customer/context_processors.pyÚgetunreadnotificationcount   s    'r   c             C   s>  d } g  } |  j  j d ƒ r(|  j  d } t j j d | ƒ j ƒ  } | r(t j j d | d d d d ƒ j ƒ  } |  j  j d ƒ r(|  j  d d	 k r¶ t j j d | ƒ j ƒ  } nr |  j  d d
 k rç t	 j j d | ƒ j ƒ  } nA |  j  d d k s|  j  d d k r(t
 j j d | ƒ j ƒ  } d | d t | ƒ i S)Nr   r   r   r	   r
   r   FÚuserroleÚcustomerÚdriverÚadminÚ
superadminZ
userdetailr   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   Zuserdetails_objr   r   r   r   r   Úgetuserdetails   s    '&r   N)Údjango.contrib.auth.modelsr   ZAdminApp.modelsr   r   ÚCustomer.modelsr   ÚDriver.modelsr   r   r   r   r   r   r   Ú<module>   s
   