o
    ÐcG  ã                   @   sÎ   d dl Z d dlmZ d dlmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZmZ e  e¡Zdd	„ ZG d
d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdS )é    N)ÚView)Úsettings)ÚJsonResponse)ÚrenderÚredirect)ÚEmailMessage)ÚPlanÚPlanTypec                 C   s   | j  d¡dkS )NÚHTTP_X_REQUESTED_WITHÚXMLHttpRequest)ÚMETAÚget)Úrequest© r   ú8/var/www/html/docker_usevoice/src/apps/profiles/views.pyÚis_ajax   s   r   c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )ÚProfileViewz Index view c                 O   ó(   |j jstdƒS ddi}d}t|||ƒS )Núlanding:indexÚpageÚoverviewzprofiles/overview.html©ÚuserÚis_authenticatedr   r   ©Úselfr   ÚargsÚkwargsÚcontextÚtemplater   r   r   r      s   ÿzProfileView.getc                 O   ó   |j jr	 d S d S ©N©r   r   ©r   r   r   r   r   r   r   Úpost   ó   ÿzProfileView.postN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r%   r   r   r   r   r      s    r   c                   @   r   )ÚSettingsViewú Settings view c                 O   r   )Nr   r   r   zprofiles/settings.htmlr   r   r   r   r   r   '   ó   ÿzSettingsView.getc           	      O   s¼   |j jstdƒS t|ƒr[|j j}|jr"|j d¡}|r"||_| ¡  |j	 d¡}|r1||_
| ¡  |j	 d¡}|j	 d¡}|rN|rN||j _||j _|j  ¡  t |j	¡ tdddœƒS 	 d S )	Nr   ÚavatarÚcountryÚ
first_nameÚ	last_nameÚsuccessz#Your profile information is updated)ÚstatusÚmessage)r   r   r   r   ÚprofileÚFILESr   r/   ÚsaveÚPOSTr0   r1   r2   ÚloggerÚinfor   )	r   r   r   r   r6   r/   r0   r1   r2   r   r   r   r%   1   s,   
zSettingsView.postNr'   r   r   r   r   r,   %   ó    
r,   c                   @   r   )ÚSecurityViewr-   c                 O   r   )Nr   r   Úsecurityzprofiles/security.htmlr   r   r   r   r   r   M   r.   zSecurityView.getc                 O   r!   r"   r#   r$   r   r   r   r%   W   r&   zSecurityView.postNr'   r   r   r   r   r=   K   r<   r=   c                   @   r   )ÚBillingViewr-   c                 O   r   )Nr   r   Úsubscriptionzprofiles/billing.htmlr   r   r   r   r   r   ^   r.   zBillingView.getc                 O   r!   r"   r#   r$   r   r   r   r%   h   r&   zBillingView.postNr'   r   r   r   r   r?   \   r<   r?   c                   @   r   )ÚStatementsViewr-   c                 O   r   )Nr   r   Ú
statementszprofiles/statements.htmlr   r   r   r   r   r   o   r.   zStatementsView.getc                 O   r!   r"   r#   r$   r   r   r   r%   y   r&   zStatementsView.postNr'   r   r   r   r   rA   m   r<   rA   c                   @   r   )ÚLogsViewr-   c                 O   r   )Nr   r   Úlogszprofiles/logs.htmlr   r   r   r   r   r   €   r.   zLogsView.getc                 O   r!   r"   r#   r$   r   r   r   r%   Š   r&   zLogsView.postNr'   r   r   r   r   rC   ~   r<   rC   )ÚloggingÚdjango.viewsr   Údjango.confr   Údjango.httpr   Údjango.shortcutsr   r   Údjango.core.mail.messager   Úapps.subscriptions.modelsr   r	   Ú	getLoggerÚ__file__r:   r   r   r,   r=   r?   rA   rC   r   r   r   r   Ú<module>   s    
&