ó
sC'Xc           @   sb   d  d l  m Z m Z m Z d  d l m Z d  d l m Z d  d l m	 Z	 d „  Z
 d „  Z d S(   iÿÿÿÿ(   t   render_to_responset   rendert   redirect(   t   HttpResponse(   t   Lldevicelist(   t   user_get_languagec         C   s   |  j  j ƒ  r g  } |  j  j ƒ  } x( | D]  } | j | j d ƒ d ƒ q+ Wt j j d | ƒ } t d i |  j  d 6| d 6t	 |  ƒ d 6ƒ St
 d ƒ Sd  S(	   Nt   .i   t   id__ins   devices.htmlt   user_objectt   device_listt   langs   /leakless-monitor(   t   usert   is_authenticatedt   get_all_permissionst   appendt   splitR   t   objectst   filterR    R   R   (   t   requestt	   permfieldt   permission_listt
   permissionR	   (    (    s`   D:\SMTech Code\LeakLess Software\LeakLess Monitor\LeakLess Monitor\Applications\Devices\views.pyt   devices_return_table   s    +c         C   s­   |  j  j ƒ  rŸ yi |  j j d ƒ } |  j j d ƒ } |  j j d ƒ } t j j d | ƒ j d | d | ƒ t d ƒ SWq© t	 k
 r› } t d | j
 ƒ SXn
 t d	 ƒ Sd  S(
   Nt	   device_idt   latitudet	   longitudet   idt   loc_latt   loc_longs   Values successfully changeds   Error: s   /leakless-monitor(   R   R   t   GETt   getR   R   R   t   updateR   t	   Exceptiont   messageR   (   R   R   R   R   t   e(    (    s`   D:\SMTech Code\LeakLess Software\LeakLess Monitor\LeakLess Monitor\Applications\Devices\views.pyt   devices_change_lat_long   s    %N(   t   django.shortcutsR    R   R   t   django.httpR   t   Applications.Devices.modelsR   t   Applications.Users.viewsR   R   R#   (    (    (    s`   D:\SMTech Code\LeakLess Software\LeakLess Monitor\LeakLess Monitor\Applications\Devices\views.pyt   <module>   s
   	