
    kh	                         d dl Z d dlmZ d dlmZ d dlmZmZm	Z	 d dl
mZ d dlmZmZmZ  G d de          Z G d	 d
e          Z G d de          Z G d de          ZdS )    N)gettext_lazy)Document)DateTimeFieldIntFieldStringField)QuerySetManager)AutoSlugFieldCreationDateTimeFieldModificationDateTimeFieldc                   T    e Zd ZdZ e            Z e            Z G d d          ZdS )TimeStampedModelz|
    TimeStampedModel

    An abstract base class model that provides self-managed "created" and
    "modified" fields.
    c                       e Zd ZdZdS )TimeStampedModel.MetaTN__name__
__module____qualname__abstract     W/var/www/histauto/venv/lib/python3.11/site-packages/django_extensions/mongodb/models.pyMetar              r   r   N)	r   r   r   __doc__r
   createdr   modifiedr   r   r   r   r   r      sd          $#%%G((**H         r   r   c                   v    e Zd ZdZ ed          Z ed          Z edd          Z G d d	          Z	d
S )TitleSlugDescriptionModelz
    TitleSlugDescriptionModel

    An abstract base class model that provides title and description fields
    and a self-managed "slug" field that populates from the title.
       )
max_lengthtitle)populate_fromT)blanknullc                       e Zd ZdZdS )TitleSlugDescriptionModel.MetaTNr   r   r   r   r   r&   +   r   r   r   N)
r   r   r   r   r   r!   r	   slugdescriptionr   r   r   r   r   r      s          K3'''E=w///D+Dt444K         r   r   c                   ,     e Zd ZdZ fdZ fdZ xZS )ActivatorModelManagerz
    ActivatorModelManager

    Manager to return instances of ActivatorModel:
        SomeModel.objects.active() / .inactive()
    c                 l    t                                                                          d          S )z`
        Return active instances of ActivatorModel:

        SomeModel.objects.active()
           statussuperget_querysetfilterself	__class__s    r   activezActivatorModelManager.active7   ,     ww##%%,,A,666r   c                 l    t                                                                          d          S )zd
        Return inactive instances of ActivatorModel:

        SomeModel.objects.inactive()
        r   r-   r/   r3   s    r   inactivezActivatorModelManager.inactive?   r7   r   )r   r   r   r   r6   r9   __classcell__r5   s   @r   r*   r*   /   s[         7 7 7 7 77 7 7 7 7 7 7 7 7r   r*   c                        e Zd ZdZd ed          fd ed          ffZ eed          Z edd ed          	          Z	 edd ed
          	          Z
 e            Z G d d          Z fdZ xZS )ActivatorModelzh
    ActivatorModel

    An abstract base class model that provides activate and deactivate fields.
    r   Inactiver,   Active)choicesdefaultTz&keep empty for an immediate activation)r#   r$   	help_textz$keep empty for indefinite activationc                       e Zd ZdZdS )ActivatorModel.MetaTNr   r   r   r   r   rD   \   r   r   r   c                     | j         s#t          j                                        | _          t                      j        |i | d S )N)activate_datedatetimenowr0   save)r4   argskwargsr5   s      r   rI   zActivatorModel.save_   sF    ! 	9!)!2!6!6!8!8Dd%f%%%%%r   )r   r   r   r   _STATUS_CHOICESr   r.   r   rF   deactivate_dater*   objectsr   rI   r:   r;   s   @r   r=   r=   H   s         
AAjMM	
AAhKKN Xna888F!M+S)T)T  M $m+Q)R)R  O $#%%G       & & & & & & & & &r   r=   )rG   django.utils.translationr   rL   mongoengine.documentr   mongoengine.fieldsr   r   r   mongoengine.querysetr    django_extensions.mongodb.fieldsr	   r
   r   r   r   r*   r=   r   r   r   <module>rU      sF    6 6 6 6 6 6 ) ) ) ) ) ) C C C C C C C C C C 0 0 0 0 0 0             x           7 7 7 7 7O 7 7 72& & & & &X & & & & &r   