
    >Tf*                     P    d dl Z d dlmZ d dlmZ dZ G d dej                  ZdS )    N)forms)gettext_lazy)CheckLastUpdatedMixinc                   l     e Zd ZdZ ej        ej        d ej                              Z fdZ	 xZ
S )r   a  
    Checks whether the object being saved has been updated since the form was initialized. If so, validation fails.
    This prevents a user from inadvertently overwriting any changes made to the object between when the form was
    initialized and when it was submitted.

    This validation does not apply to newly created objects, or if the `_init_time` field is not present in the form
    data.
    F)initialrequiredwidgetc                 T   t                                                       | j        r| j        j        sd S | j                            d          x}sd S t          | j        dd           x}sd S ||                                k     r!t          j	        t          d                    d S )N
_init_timelast_updatedznThis object has been modified since the form was rendered. Please consult the object's change log for details.)supercleaninstancepkcleaned_datagetgetattr	timestampr   ValidationError_)selfform_init_timer   	__class__s      ;/var/www/html/netbox-4.1.3/netbox/utilities/forms/mixins.pyr   zCheckLastUpdatedMixin.clean   s     } 	DM$4 	F #'"3"7"7"E"EE 	F !(~t L LL 	F L224444'#) )    54    )__name__
__module____qualname____doc__r   DecimalFieldtimeHiddenInputr   r   __classcell__)r   s   @r   r   r      ss          $#	 u ""  J        r   r   )	r!   djangor   django.utils.translationr   r   __all__Formr    r   r   <module>r)      so           6 6 6 6 6 6
# # # # #EJ # # # # #r   