B
    b	                 @   sP   d dl mZ d dlmZ d dlmZ d dlmZ e	eG dd dej
ZdS )    )admin)AppNotification)gettext_lazy)Employeec                   s6   e Zd ZdZdZdd Z fddZede_  Z	S )AppNotificationAdmin)Zreceivercategoryget_content_displaysourcesenderZnotification_timeZread_status)Zreceiver__emp_codeZreceiver__first_namer
   contentc             C   s2   |j }|j r.t|j dkr.d|j d d }|S )N   z{0}....)r   lenformat)selfobjr    r   ?G:\easytimepro\master/mysite/mobile\admin\notification_admin.pyr      s    z(AppNotificationAdmin.get_content_displayc                sv   t t| |j|jjd}|jjsr|jj}|jj}|	 rL|j|
 d}|	 rrtjj|
 d}|j|d}|S )N)Z receiver__department__company_id)Zreceiver__department__in)Zarea__in)Zreceiver__in)superr   get_querysetfilteruserZcurrent_companyZis_superuserZget_auth_deptZget_auth_areaexistsallr   Zobjects)r   ZrequestZqsZ	auth_deptZ	auth_areaZemp_list_by_area)	__class__r   r   r      s    z!AppNotificationAdmin.get_querysetZappNotice_field_content)
__name__
__module____qualname__Zlist_displayZlist_filterr   r   _Zshort_description__classcell__r   r   )r   r   r      s
   r   N)mysiter   Zmysite.mobile.modelsr   Zdjango.utils.translationr   r   Z&mysite.personnel.models.model_employeer   registerZZKModelAdminr   r   r   r   r   <module>   s
   