o
    h                     @   sD   d dl mZ ddlmZmZ G dd dejZG dd dejZdS )	    )forms   )FeedbackFeedbackCategoryc                   @   s*   e Zd ZejddejdddddZdS )	VerificationForm2   Tform-controlzEnter your registration codeclassplaceholderattrs)
max_lengthrequiredwidgetN)__name__
__module____qualname__r   	CharField	TextInputregistration_code r   r   -/var/www/html/smartRegister/feedback/forms.pyr      s    
r   c                       s6   e Zd ZG dd dZ fddZ fddZ  ZS )FeedbackFormc                
   @   s   e Zd ZeZg dZejddddejddddejddddej	dd	idej
dd
idejdddddejddiddZdS )zFeedbackForm.Meta)nameemailr   categoryratingcommentis_anonymousr   z/Your name (optional if using registration code)r	   r   zYour email (optional)z%Your registration code (if available)r
   zform-selectzrating-inputzPlease share your feedback here   )r
   r   rowszform-check-inputN)r   r   r   r   modelfieldsr   r   
EmailInputSelectRadioSelectTextareaCheckboxInputwidgetsr   r   r   r   Meta   s<    
r*   c                    s   t  j|i | d| jd _d| jd _d| jd _d| jd _d| jd _d| jd _d| jd	 _d
| jd	 _tjjdd| jd _d S )NFr   r   r   Tr   r   r   r   zSubmit anonymously)	is_active)	super__init__r#   r   labelr   objectsfilterqueryset)selfargskwargs	__class__r   r   r-   /   s   zFeedbackForm.__init__c                    sN   t   }|d}|d}|d}|d}|s%|s%|s%| dd |S )Nr   r   r   r   zKPlease provide your name or registration code if not submitting anonymously)r,   cleanget	add_error)r2   cleaned_datar   r   r   r   r5   r   r   r7   =   s   




zFeedbackForm.clean)r   r   r   r*   r-   r7   __classcell__r   r   r5   r   r      s     r   N)	djangor   modelsr   r   Formr   	ModelFormr   r   r   r   r   <module>   s    
