B
    GDb                 @   sD   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)actions)AppListc                   s<   e Zd ZdZdZdZejejej	ej
gZ fddZ  ZS )AppListAdmin)username
login_timeZlast_activeZ	client_idZdevice_tokenZclient_categoryactiveenable)r   r	   )r   r   r	   r   c                s   ddl m} tt| |j|jjd}|jjs|jj	}|jj
}| r||jj| d}|rldd |D ng }|j|d}| r|jj| d }|rd	d |D ng }|j|d}|S )
Nr   )Employee)Z
company_id)Zdepartment__inc             S   s   g | ]
}|j qS  )emp_code).0er   r   :G:\easytimepro\master/mysite/mobile\admin\applist_admin.py
<listcomp>    s    z-AppListAdmin.get_queryset.<locals>.<listcomp>)Zusername__in)Zarea__inc             S   s   g | ]
}|j qS r   )r   )r   r   r   r   r   r   $   s    )Z&mysite.personnel.models.model_employeer
   superr   get_querysetfilteruserZcurrent_companyZis_superuserZget_auth_deptZget_auth_areaexistsZobjectsallZdistinct)selfZrequestr
   ZqsZ	auth_deptZ	auth_areaZempZ	name_list)	__class__r   r   r      s    zAppListAdmin.get_queryset)__name__
__module____qualname__Zlist_displayZsort_fieldsZlist_filterr   Zpush_notificationZforce_offlineZdisabler	   r   __classcell__r   r   )r   r   r      s   r   N)	mysiter   Zmysite.mobiler   Zmysite.mobile.modelsr   registerZZKModelAdminr   r   r   r   r   <module>   s   