o
    6k~i                     @   s.   d dl mZ d dlmZ G dd dejZdS )    )models)gettext_lazyc                   @   s,  e Zd ZdZdedfdedfdedfded	fd
edfdedfgZejdeddZejdeddZ	ej
deddZejdeeddZejededdZejdeddZejeddZejed dZejd!ed"dZejdd#Zejdd$ZG d%d& d&Zd'd( Zed)d* Zd+S ),AdzAd ModeloffersOffersplacePlaceexternal_urlzExternal URLcategoryCategoryfilter_by_ratingzFilter by RatingbookingBooking   Title)
max_lengthverbose_namei,  Subtitlezads/Image)	upload_tor   2   zAction Type)r   choicesr   TzAction Data)defaultblankr   z	Is Active)r   r   z
Start Date)r   zEnd Dater   Priority)auto_now_add)auto_nowc                   @   sB   e Zd ZedZedZddgZejg ddejdgdgZ	dS )	zAd.Metar   Adsz	-priorityz-created_at)	is_active
start_dateend_date)fieldsaction_typeN)
__name__
__module____qualname___r   verbose_name_pluralorderingr   Indexindexes r+   r+   //var/www/newdalilibackend/backend/ads/models.pyMeta$   s    r-   c                 C   s   | j S )N)title)selfr+   r+   r,   __str__-   s   z
Ad.__str__c                 C   s6   ddl m} | }| jo| j|  ko| jkS   S )Nr   )timezone)django.utilsr1   nowr   r   r    )r/   r1   r3   r+   r+   r,   is_valid0   s   "zAd.is_validN)r#   r$   r%   __doc__r&   ACTION_TYPESr   	CharFieldr.   subtitle
ImageFieldimager"   	JSONFielddictaction_dataBooleanFieldr   DateTimeFieldr   r    IntegerFieldpriority
created_at
updated_atr-   r0   propertyr4   r+   r+   r+   r,   r      s@    





		r   N)	django.dbr   django.utils.translationr   r&   Modelr   r+   r+   r+   r,   <module>   s    