o
    h                     @   s   d dl mZ d dlmZ d dlmZ G dd dejZG dd dejZG dd	 d	ejZ	G d
d dejZ
G dd dejZdS )    )models)timezone)Userc                   @   s\   e Zd ZejdddZejdddZe Z	ej
ddZejddZejddZdd	 Zd
S )Event   T
max_lengthunique)blanknulldefaultauto_now_add)auto_nowc                 C   s   | j S )N)nameself r   0/var/www/html/smartRegister/attendance/models.py__str__   s   zEvent.__str__N)__name__
__module____qualname__r   	CharFieldr   	TextFielddescription	DateFielddateBooleanField	is_activeDateTimeField
created_at
updated_atr   r   r   r   r   r      s    r   c                   @   sR   e Zd ZejeejddZejeejddZ	ej
ddZG dd dZdd	 Zd
S )EventAssignmentassignments	on_deleterelated_nameevent_assignmentsTr   c                   @      e Zd ZddgZdZdZdS )zEventAssignment.MetaeventuserzEvent AssignmentzEvent AssignmentsNr   r   r   unique_togetherverbose_nameverbose_name_pluralr   r   r   r   Meta       r1   c                 C      | j j d| jj S Nz assigned to )r,   usernamer+   r   r   r   r   r   r         zEventAssignment.__str__N)r   r   r   r   
ForeignKeyr   CASCADEr+   r   r,   r!   assigned_atr1   r   r   r   r   r   r$      s    r$   c                   @   s   e Zd ZejdddZe ZejddZejddZ	ejddZ
ejddZejddZe ZejdddZejd	d
ZejdddZdd ZdS )RegisteredUserd   Tr   r   r   
      )
max_digitsdecimal_placesFr   )r   r
   c                 C   s   | j  d| j dS )Nz ())	full_nameregistration_coder   r   r   r   r   -   s   zRegisteredUser.__str__N)r   r   r   r   r   rC   
EmailFieldemailrB   
event_namestatuspayment_statuspackage_namer   package_descriptionDecimalFieldactivity_pricer   has_attendedr!   	timestampr   r   r   r   r   r:       s    r:   c                       s\   e Zd ZejeejddZejddZ	ej
ddZG dd dZd	d
 Z fddZ  ZS )
Attendanceattendancesr&   r   r<   Tr   c                   @   s   e Zd ZddgZdZdS )zAttendance.Metar,   rF   rO   N)r   r   r   r.   r0   r   r   r   r   r1   6   s    r1   c                 C   s"   | j j d| j d| jd S )Nz - z%Y-%m-%d %H:%M)r,   rB   rF   check_in_timestrftimer   r   r   r   r   :   s   "zAttendance.__str__c                    s<   | j jsd| j _t | j _| j   t j|i | d S )NT)r,   rM   r   nowrN   savesuper)r   argskwargs	__class__r   r   rT   =   s
   
zAttendance.save)r   r   r   r   r7   r:   r8   r,   r   rF   r!   rQ   r1   r   rT   __classcell__r   r   rX   r   rO   1   s    rO   c                   @   sb   e Zd ZdZejdejddZejeejddZ	ej
ddZejddZG d	d
 d
Zdd ZdS )RegistrationEventAssignmentzDModel to assign registration events to users for attendance scanningzregistration.Eventattendance_assignmentsr&   registration_event_assignmentsTr   r   c                   @   r*   )z RegistrationEventAssignment.Metaregistration_eventr,   zRegistration Event AssignmentzRegistration Event AssignmentsNr-   r   r   r   r   r1   M   r2   r1   c                 C   r3   r4   )r,   r5   r^   r   r   r   r   r   r   R   r6   z#RegistrationEventAssignment.__str__N)r   r   r   __doc__r   r7   r8   r^   r   r,   r!   r9   r   r    r1   r   r   r   r   r   r[   F   s    r[   N)	django.dbr   django.utilsr   django.contrib.auth.modelsr   Modelr   r$   r:   rO   r[   r   r   r   r   <module>   s    