
    si                         d Z ddlmZ ddlmZ ddlmZ ddlmZ	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ  eed       e ed      d       G d de                    Zy)zT
This page is handling the cbv methods of mail log tab in employee individual page.
    )Any)reverse)method_decorator)gettext_lazy)MailLogTabList)login_required)HorillaListView)all_manager_can_enter)	Candidatedispatch)namezrecruitment.view_candidate)permc                   8     e Zd ZdZdef fdZd Z fdZ xZS )CandidateMailLogTabListz1
    list view for mail log tab in candidate
    kwargsc                     t        |   di |}| j                  j                  d      }t	        dd|i       |d<   |S )zX
        Adds a search URL to the context based on the candidate's primary key.
        pkzcandidate-mail-log-list)r   
search_url )superget_context_datar   getr   )selfr   contextr   	__class__s       F/var/www/python-projects/worksol/recruitment/cbv/candidate_mail_log.pyr   z(CandidateMailLogTabList.get_context_data   sL     '*4V4[[__T"0r
CD 	     c                     | j                   j                  d      }t        j                  j                  |      }t	        j
                  |       j                  |j                        j                  d      S )zd
        Returns a filtered and ordered queryset of email logs for the specified candidate.
        r   )id)to__icontainsz-created_at)	r   r   r   objectsr	   get_querysetfilteremailorder_by)r   r   candidate_objs      r   r"   z$CandidateMailLogTabList.get_queryset&   s^     [[__T"!))---4((.V-"5"5V6Xm$	
r   c                 2    t        t        | 
  |g|i |S )z.
        To avoide parent permissions
        )r   r   r   )r   requestargsr   r   s       r   r   z CandidateMailLogTabList.dispatch4   s!     ^T3GMdMfMMr   )	__name__
__module____qualname____doc__r   r   r"   r   __classcell__)r   s   @r   r   r      s%    
	 	
N Nr   r   N)r-   typingr   django.urlsr   django.utils.decoratorsr   django.utils.translationr   _base.cbv.mail_log_tabr   horilla_views.cbv_methodsr   horilla_views.generic.cbv.viewsr	   recruitment.cbv_decoratorsr
   recruitment.modelsr   r   r   r   r   <module>r9      sd      4 6 0 4 ; < ( .z2;<:"Nn "N 3"Nr   