403Webshell
Server IP : 65.108.144.40  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64
User : dev ( 1000)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/erp/base/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/erp/base/__pycache__/announcement.cpython-310.pyc
o

hͦh�4�@s�dZddlZddlmZmZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddlmZdd	lmZmZdd
lmZddlmZddlmZmZdd
lmZmZddlmZm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&m'Z'm(Z(ddl)m*Z*e'e&dd���Z+e'e&dd���Z,e'e&dd���Z-e'e&dd���Z.e'e&dd���Z/e'e&dd���Z0e'e&dd���Z1e'e&d%d d!���Z2e'e&e(d"�d#d$����Z3dS)&zV
Module for managing announcements, including creation, updates, comments, and views.
�N)�datetime�	timedelta)�messages)�User)�	EmptyPage�PageNotAnInteger�	Paginator)�Q)�HttpResponse)�redirect�render)�reverse)�gettext_lazy)�AnnouncementCommentForm�AnnouncementForm)�closest_numbers�filter_own_records)�Announcement�AnnouncementComment�AnnouncementExpire�AnnouncementView)�Employee)�hx_request_required�login_required�permission_required)�notifycCs
tjjddd���pd}tj��}g}|jdd�D]}|jt|d�|_	|�
|�q|r4tj�|dg�|jt�
���d�}|j�d	�rG|}n|�t|jjd
�tdd�B�}|�d��d
�}|D]}|jj|jdd���|_q`t�dd�|D��}|||d�}t|d|�S)N�daysT)�flat�)�expire_date__isnull)r�expire_date)�expire_date__gte�base.view_announcement)�	employees)�employees__isnull�announcementview_set�-created_at)�user�viewedcSsg|]}|j�qS���id)�.0�instancer)r)�!/var/www/erp/base/announcement.py�
<listcomp>@sz%announcement_list.<locals>.<listcomp>)�
announcements�general_expire_date�instance_idsz$announcement/announcements_list.html)r�objects�values_list�firstr�all�filter�
created_atrr �append�bulk_updater�today�dater'�has_permr	�employee_get�prefetch_related�order_byr%�exists�
has_viewed�json�dumpsr)�requestr1r0�announcements_to_update�announcement�announcement_listr2�contextr)r)r.rHsD�

�������rHc
CsHt�}|jdkr�t|j|j�}|��r�|jdd�\}}|��|j�|�|jd}|jd}|jd}|jd}|j	�|�|j
�|�|j�|�t�
|td��tjj|d	�}tjj|d
�}	|tjj|d�B}|tjj|d�B}|jj|�tj|jj|d
ddddddd�	tj|jj|	dddddddd�	t�}t|dd|i�S)�F
    This method renders form and template to update Announcement
    �POSTF��commitr#�
department�job_position�
company_idz"Announcement created successfully.��3employee_get__employee_work_info__department_id__in��5employee_get__employee_work_info__job_position_id__in��%employee_work_info__department_id__in��'employee_work_info__job_position_id__in�(Your department was mentioned in a post.�%تم ذكر قسمك في منشور.�.Ihr Abteilung wurde in einem Beitrag erwähnt.�3Tu departamento fue mencionado en una publicación.�3Votre département a été mentionné dans un post.�/�chatbox-ellipses��	recipient�verb�verb_ar�verb_de�verb_es�verb_frr�icon�*Your job position was mentioned in a post.�)تم ذكر وظيفتك في منشور.�5Ihre Arbeitsposition wurde in einem Beitrag erwähnt.�8Tu puesto de trabajo fue mencionado en una publicación.�7Votre poste de travail a été mentionné dans un post.z#announcement/announcement_form.html�form)r�methodrK�FILES�is_valid�save�attachments�set�cleaned_datarNrOrPr�success�_rr3r7rr#�addr�sendr'r>r)
rErm�anou�attachment_idsr#�departments�
job_positions�company�emp_dep�emp_jobsr)r)r.�create_announcementIsh




������r�cCs�t�|�}|r|��t�|td��|j�d�}t�	|�}|r%t
||�nd\}}||vr2|�|�|rL||krLtdd|id�}t
|�dt�|����St
t�S)z6
    This method is used to delete announcements.
    z"Announcement deleted successfully.r2�NNzannouncement-single-view�anoun_id)�kwargsz?instance_ids=)r�find�deleterrurv�GET�getrC�loadsr�remover
rrD�announcement_single_view)rEr�rGr2�instance_ids_list�__�next_instance_id�urlr)r)r.�delete_announcement�s 

��
r�c
Csftjj|d�}t|d�}|j�d�}|jdkr�t|j|j|d�}|��r�|j	dd�\}}|�	�}|j
�|�|jd}|jd}|jd	}	|jd
}
|j
�|�|j�|	�|j�|
�t�|td��tjj|d�}tjj|	d
�}|tjj|d�B}|tjj|	d�B}|jj|�tj|jj|dddddddd�	tj|jj|dddddddd�	t|d||d��S)rJr*)r-r2rKFrLr#rNrOrPz"Announcement updated successfully.rQrSrUrWrYrZr[r\r]r^r_r`rhrirjrkrlz*announcement/announcement_update_form.html)rmr2)rr3r�rr�rnrKrorprqrrrsrtrNrOrPrrurvrr7rr#rwrrxr'r>r)
rEr�rGrmr2ryrzr#r{r|r}r~rr)r)r.�update_announcement�sr





�������r�c	Cs,tjj|d���}|jj}t|j|d�d�}tjj|d�}g}|r-|D]	}|�	|j
j�q#tt
|��}|jdkr�t|j�}|��r�||j_
||j_|��t|j|d�d�}t�|td��tj|jj|d|j�d�d	|j�d�d
|j�d�d|j�d�d|j�d�d
dd�	td|d�St|d||d��S)zO
    This method renders form and template to create Announcement comments
    r*)�employee_id�
request_id)�initial��announcement_idrKzYou commented a post.zComment under the announcement �.u!تعليق تحت الإعلان u!Kommentar unter der Ankündigung zComentario bajo el anuncio zCommentaire sous l'annonce r^r_r`zannouncement-view-comment)r��announcement/comment_view.html)rmr�)rr3r7r5r'r>rr+rr9r��employee_user_id�listrsrnrKrpr-r�rqrrurvrrx�titlerr)	rEr��anoun�emprm�comments�commentators�i�unique_usersr)r)r.�create_announcement_comment�sL
�


���r�cCsTtjj|d��d�}tjj|d�}t||d�}d}|��sd}t|d||||d��S)	zG
    This method is used to view all comments in the announcements
    r�r&r*zbase.view_announcementcommentFTr�)r��no_commentsr�rG)	rr3r7r@rr�rrAr)rEr�r�rGr�r)r)r.�comment_views"���r�cCs,tjj|d�}|��t�|td��t�S)z=
    This method is used to delete announcement comments
    r*zComment deleted successfully!)rr3r�r�rrurvr
)rE�
comment_id�commentr)r)r.�delete_announcement_comment5sr�c
Cs�t�|�}|j�d�}|rt�|�ng}|rt||�nd\}}|r3tjj	|j
|d�\}}d|_|��||||d�}	t
|d|	�S)z=
    This method is used to render single announcements.
    r2r�)r'rGT)rGr2�previous_instance_idr�z"announcement/announcement_one.html)rr�r�r�rCr�rrr3�
get_or_creater'r(rqr)
rEr��announcement_instancer2r�r�r��announcement_view_objrvrIr)r)r.r�As&
��
��r�r"cCs,|j�d�}tjj|dd�}t|dd|i�S)z3
    This method is used to view the employees
    r�T)�announcement_id__idr(zannouncement/viewed_by.html�	viewed_by)r�r�rr3r7r)rEr��viewed_usersr)r)r.r�`s
�r�)N)4�__doc__rCrr�django.contribr�django.contrib.auth.modelsr�django.core.paginatorrrr�django.db.modelsr	�django.httpr
�django.shortcutsrr�django.urlsr
�django.utils.translationrrv�
base.formsrr�base.methodsrr�base.modelsrrrr�employee.modelsr�horilla.decoratorsrrr�notifications.signalsrrHr�r�r�r�r�r�r�r�r)r)r)r.�<module>sZ)>C.


Youez - 2016 - github.com/yon3zu
LinuXploit