o
    Fi                     @   s@   d dl mZ d dlmZ G dd dejZG dd dejZdS )    )models)timezonec                   @   sV   e Zd ZejdddZejdddZejddZej	ddZ
G dd dZd	d
 ZdS )EventCategoryd   T)
max_lengthunique2   blankauto_now_addc                   @   s   e Zd ZdZdZdgZdS )zEventCategory.MetazEvent CategoryzEvent CategoriesnameN)__name__
__module____qualname__verbose_nameverbose_name_pluralordering r   r   9/var/www/html/smartRegister/backend/apps/events/models.pyMeta   s    
r   c                 C      | j S Nr   selfr   r   r   __str__      zEventCategory.__str__N)r   r   r   r   	CharFieldr   code	TextFielddescriptionDateTimeField
created_atr   r   r   r   r   r   r      s    r   c                   @   s  e Zd Zg dZejddZejeej	ddddZ
ejdedd	d
ZejddZe Ze ZejdddZejddZejdddddZejddZejddZejdddZejdddZejddddZejdddZejddddddZejddddddZejdddZejdej	ddd d!d"Z ejdd#Z!ejdd$Z"G d%d& d&Z#d'd( Z$d)d* Z%d+d, Z&e'd-d. Z(e'd/d0 Z)d1S )2Event))ALLzAll Packages (no restriction))
CONFERENCE
Conference)TRAININGTraining)AGMr*   )EXPOExpo)GALAzGala Dinner)WORKSHOPWorkshop   )r   Tevents)	on_deletenullr
   related_namer   r%   zuUsed for package validation. Members are admitted if their package name contains this keyword (or event_type is ALL).)r   choicesdefault	help_textr	   )r   r
   F)r6   
      )
max_digitsdecimal_placesr3   r
   )r3   r
   z2Whether public registration is open for this event)r6   r7   z$Max registrations (null = unlimited))r3   r
   r7   z;Allow members to self-check-in via the public /checkin page	      zbVenue latitude for geofencing (leave blank to use default: Avani Victoria Falls Resort -17.856000))r:   r;   r3   r
   r7   zFVenue longitude for geofencing (leave blank to use default: 25.858000)i  zCGeofence radius in metres. Members outside this radius are blocked.r   
sub_eventsz$Parent event for sub-events/sessions)r2   r3   r
   r4   r7   r   )auto_nowc                   @   s   e Zd ZdgZdS )z
Event.Metaz-start_dateN)r   r   r   r   r   r   r   r   r   A   s    
r   c                 C   r   r   r   r   r   r   r   r   D   r   zEvent.__str__c                 C   s*   d| _ d| _t | _| jg dd d S )NTFis_archived	is_activearchived_atupdate_fields)rA   rB   r   nowrC   saver   r   r   r   archiveG   s   
zEvent.archivec                 C   s&   d| _ d| _d | _| jg dd d S )NFTr@   rD   )rA   rB   rC   rG   r   r   r   r   	unarchiveM   s   zEvent.unarchivec                 C   s
   | j  S r   )registrationscountr   r   r   r   registration_countS   s   
zEvent.registration_countc                 C   s   | j d u rdS | j| j kS )NF)max_capacityrL   r   r   r   r   is_at_capacityW   s   
zEvent.is_at_capacityN)*r   r   r   EVENT_TYPE_CHOICESr   r   r   
ForeignKeyr   SET_NULLcategory
event_typer    r!   r"   
start_dateend_datelocationBooleanFieldis_paidDecimalFieldamountrB   rA   rC   is_registerablePositiveIntegerFieldrM   self_checkin_enabledself_checkin_latself_checkin_lngself_checkin_radius_mparent_eventr#   
updated_atr   r   rH   rI   propertyrL   rN   r   r   r   r   r$      sV    

r$   N)	django.dbr   django.utilsr   Modelr   r$   r   r   r   r   <module>   s    