o
    gge                     @   sL   d dl mZmZ d dlmZ d dlmZ d dlmZ ddl	m
Z
 dd Zd	S )
    )renderredirect)messages)JsonResponse)reverse   )ContactFormc                 C   s   | j dkr:t| j}| r(|  | jddkr$tddtddS t	dS | jddkr9tdd	|j
d
S nt }t| dd|iS )NPOSTzX-Requested-WithXMLHttpRequestTzOYour message has been sent successfully! You will hear from us within 24 hours.zcontact:contact)successmessageredirect_urlFz&Please correct the errors in the form.)r   r   errorszcontact/contact.htmlform)methodr   r	   is_validsaveheadersgetr   r   r   r   r   )requestr    r   "/var/www/html/gwz/contact/views.pycontact   s(   

r   N)django.shortcutsr   r   django.contribr   django.httpr   django.urlsr   formsr   r   r   r   r   r   <module>   s    