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/horilla_audit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/erp/horilla_audit/__pycache__/methods.cpython-310.pyc
o

hͦhD�@s�dZddlmZddlmZddlmZddlmZddl	m
Z
Gdd�d�Zdd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�ZdS)zI
methods.py

This module is used to write methods related to the history
�)�User)�	Paginator)�models)�render)�apply_decoratorsc@s,eZdZd	dd�Zdefdd�Zdd�ZdS)
�Bot�returnNcCs|��dS�N)�__str__��self�r
�%/var/www/erp/horilla_audit/methods.py�__init__szBot.__init__cC�dS)NzHorilla Botr
rr
r
rr
�zBot.__str__cCr)Nz>https://ui-avatars.com/api/?name=Horilla+Bot&background=randomr
rr
r
r�
get_avatarrzBot.get_avatar)rN)�__name__�
__module__�__qualname__r�strr
rr
r
r
rrs
rFcCs$|�|�}|js|s|��dSdS)N�r)�diff_against�changed_fields�delete)�entry1�entry2�dry_run�deltar
r
r�_check_and_deletes
rcCsF|j��}d}|��}|sdS|dd�D]}|t||�7}|}qdS)z9
    This method is used to remove duplicate entries
    rNr)�history_set�all�firstr)�instance�o_qs�entries_deleted�f1�f2r
r
r�remove_duplicate_history#s
��r(cCs$t||�r|j�|�}|j��SdSr	)�hasattr�_meta�	get_field�verbose_name�
capitalize)�model_class�
field_name�fieldr
r
r�get_field_label5s

r1csJg}|D]}|�dg�}�fdd�|D�}|r ||d<|�|�q|}|S)N�changescs g|]}|�dd��vr|�qS)r/�)�get)�.0�change��track_fieldsr
r�
<listcomp>Bsz"filter_history.<locals>.<listcomp>)r4�append)�	historiesr8�filtered_histories�historyr2�filtered_changesr
r7r�filter_history>s
�
�r?c
s�t|�|j��}t|���fdd�tt��d�D�}g}|jdd���}|D]y}|d�|d�}g}|dj	j
}|jD]D}	|	j}
|	j
}|j�|	j�}d}
t|tjj�rj|jrj|
rj|rjt|j�}||
}
||}t|tj�rrd}
|�t||	j�|	j|
|
|d	��q>|djr�tjj|djjd
�jnt �}|�d|||d��q(|r�z|jj}Wnt �}Y|�|j	j
jj!�"��d
�||f|d��|jj#dkr�ddlm$}|j��}|r�|j%r�|j%d}|r�t&||�}|S)zD
    This method is used to find the differences in the history
    cs g|]}�|�|dg�qS)rr
)r5�i��history_listr
rr9Ss�zget_diff.<locals>.<listcomp>r�+)�history_typerFT)r0r/�is_fk�old�new)�id�Changes)�type�pairr2�
updated_byz created)rJrKrL�employeeworkinformation)�HistoryTrackingFields�tracking_fields)'r(r r!�list�range�len�filterr"rr#�	__class__r2rFrGr*r+r0�
isinstancer�fields�	CharField�choices�dict�
ForeignKeyr:r1�history_userr�objectsr4rH�employee_getrr,r-�
model_namerNrOr?)r#r=�pairs�
delta_changes�create_historyrKr�diffs�
class_namer6rFrGr0rErXrLrN�history_tracking_instancer8r
rAr�get_diffLs�

�
����

��������



recKs2|�d�}|�dg�}t|�dd��}||||�S)N�model�
decoratorsc	SsP|jj|d�}|j��}|j�dd�}t|d�}|�|�}||d�}t|d|�S)N)�pk�pager�)r;r^z#horilla_audit/history_tracking.html)r\r4�horilla_historyr!�GETr�get_pager)	�request�obj_idrfr#r;�page_number�	paginator�page_obj�contextr
r
r�_history_tracking�s


��z+history_tracking.<locals>._history_tracking)r4r)rnro�kwargsrf�decorator_stringsrtr
r
r�history_tracking�s


rwN)F)�__doc__�django.contrib.auth.modelsr�django.core.paginatorr�	django.dbr�django.shortcutsr�horilla.decoratorsrrrr(r1r?rerwr
r
r
r�<module>s
		O

Youez - 2016 - github.com/yon3zu
LinuXploit