
    jge	                         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y)    N)gettext_lazy)Document)DateTimeFieldIntFieldStringField)QuerySetManager)AutoSlugFieldCreationDateTimeFieldModificationDateTimeFieldc                   @    e Zd ZdZ e       Z e       Z G d d      Zy)TimeStampedModelz|
    TimeStampedModel

    An abstract base class model that provides self-managed "created" and
    "modified" fields.
    c                       e Zd ZdZy)TimeStampedModel.MetaTN__name__
__module____qualname__abstract     [/var/www/html/Stanley/venv/lib/python3.12/site-packages/django_extensions/mongodb/models.pyMetar          r   r   N)	r   r   r   __doc__r
   createdr   modifiedr   r   r   r   r   r      s#     $%G(*H r   r   c                   \    e Zd ZdZ ed      Z ed      Z edd      Z G d d	      Z	y
)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y)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      s3     3'Ew/DDt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                 @    t         |          j                  d      S )z`
        Return active instances of ActivatorModel:

        SomeModel.objects.active()
           statussuperget_querysetfilterself	__class__s    r   activezActivatorModelManager.active2   !     w#%,,A,66r   c                 @    t         |          j                  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 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y)ActivatorModel.MetaTNr   r   r   r   r   rD   S   r   r   r   c                     | j                   s#t        j                  j                         | _         t        |   |i | y )N)activate_datedatetimenowr0   save)r4   argskwargsr5   s      r   rI   zActivatorModel.saveV   s4    !!!)!2!2!6!6!8Dd%f%r   )r   r   r   r   _STATUS_CHOICESr   r.   r   rF   deactivate_dater*   objectsr   rI   r:   r;   s   @r   r=   r=   C   s{     
AjM	
AhKN na8F!41EmCnoM#$TQGmEnoO#%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      sM     6 ) C C 0 l lx   7O 70&X &r   