
    Te                     `    d dl mZmZ ddlmZmZ d dlmZ d dlm	Z	 ddZ
ddZd	 Zd
 Zd ZdS )    )renderget_object_or_404   )PropertyPropertyGallery)category)LocationNc                    d }d }|r9t          t          |          }t          j                            d|d          }n!t          j                            dd          }t          j                            |                                          }|                                }d |D             }t          |d           }t          |d           }|||||d	}	t          | d
|	          S )NslugVenderTcategory__category_namelocationis_avalibler   r   property__inc                     g | ]	}|j         
S  price.0propertys     ;C:\Users\USER\Documents\GitHub\espacioelite\agency\views.py
<listcomp>zcomprar.<locals>.<listcomp>       999(x~999    default
properties	locationsproperty_countprecio_maximoprecio_minimozagency/comprar.html
r   r	   r   objectsfilterdistinctcountmaxminr   
requestlocation_slugr   r#   r$   r%   preciosr&   r'   contexts
             r   comprarr4      s   HJ  a$XMBBB%,,XX`nr,ss

%,,X[_,``
  ''Z'@@IIKKI%%''N99j999G...M...M (&& G '0':::r   c                    d }d }|r9t          t          |          }t          j                            d|d          }n!t          j                            dd          }t          j                            |                                          }|                                }d |D             }t          |d           }t          |d           }|||||d	}	t          | d
|	          S )Nr   RentarTr   r   r   c                     g | ]	}|j         
S r   r   r   s     r   r   zrentar.<locals>.<listcomp>1   r   r   r    r"   zagency/rentar.htmlr(   r/   s
             r   rentarr8   "   s   HJ  a$XMBBB%,,XX`nr,ss

%,,X[_,``
  ''Z'@@IIKKI%%''N99j999G...M...M (&& G '.w777r   c                 x   	 t           j                            ||          }n# t          $ r}|d }~ww xY wt          j                            |j                  }t          t          |j	                            }d|j
                            dd          z   dz   |z   dz   }|||d}t          | d	|          S )
N)category__slugr   )property_id' z%20z'%20por%20valor%20de%20$%20u4   %20COP,%20por%20favor%20darme%20más%20información.)single_propertyproperty_gallerymensajezagency/property_detail.html)r   r)   get	Exceptionr   r*   idint_a_moneda_strintr   property_namereplacer   )	r0   category_slugproperty_slugr>   er?   precior@   r3   s	            r   property_detailrL   >   s     (,,M},]]    '.55/BT5UUC 56677F-55c5AAAB__`ff  h^  ^G)+ G
 '7@@@s   !$ 
505c                 "    t          | d          S )Nzagency/inicio.html)r   )r0   s    r   iniciorN   O   s    './//r   c                     t          |           }g }|r)|                    |dd                     |d d         }|)d                    t          |                    }|S )N.)strappendjoinreversed)numero
numero_strgruposnumero_formateados       r   rD   rD   R   so    VJ F
 %jo&&&_
  %
 &!1!122r   )N)django.shortcutsr   r   modelsr   r   category.modelsr   location.modelsr	   r4   r8   rL   rN   rD   r   r   r   <module>r^      s    6 6 6 6 6 6 6 6 - - - - - - - - $ $ $ $ $ $ $ $ $ $ $ $; ; ; ;88 8 8 88A A A"0 0 0    r   