U
    f	                     @   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 d dl	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d ZdS )    N)HTTPResponse)messages)HttpResponse)render)Extenos)GestorAutorizado)TipoDocumento)buscar_persona)render_to_pdfc                 C   s6  d }| j rt| j  | j dr8tjj| j dd}nt }| j d|_| j d|_| j d|_| j d|_| j d|_	| j d|_
| j d	|_| j d
|_| j d|_|  t| tjd | jdr
tjj| jdd}d|i}td|S tj tj |tj d}t| d|S )Nid)r   cedulanombres	apellidosconcesionarioruccantonf1f2costozSe ha registrado..!gestorzGestores/pdfRegistro.html)	consultas
documentosr   gestoreszGestores/index.html)POSTprintgetr   objectsr   r   r   r   ruc_empresar   fecha_emisionfecha_caducidadr   saver   add_messageSUCCESSGETr
   r   allr   r   )requestr   contexto r'   +/var/www/html/TransitoApp/Gestores/views.pyr      s:    
 
r   c                 C   s   t | jd}d}d|kr$|d }d|kr<|d|d  7 }|d d |d  ||d |d |d	 |d
 d}tj|dd}tt|ddS )Nr    	apellido1	apellido2 nombre1nombre2	direcciontelefonoemail)r   r   r   r/   r0   r1      )indentzapplication/json)content_type)r	   r#   r   jsondumpsr   )r%   personaZap1dataZjson_objectr'   r'   r(   consultar_nombre3   s    r9   )r5   http.clientr   django.contribr   django.httpr   django.shortcutsr   Consultas.modelsr   ZGestores.modelsr   ZOficios.modelsr   TransitoApp.btfsoapr	   TransitoApp.snnipersr
   r   r9   r'   r'   r'   r(   <module>   s   #