
    Wf_
                     j    d dl mZ d dlZd dlmZ d dlmZ ddlmZm	Z	m
Z
 ddlmZmZmZ d Zd	 Zd
 Zy)    )verify_tokenN)JsonResponse)status   )VehicleModelsVehicleTypesTransmissionTypes)VehicleTypesSerializerVehicleModelsSerializer"VehicleTransmissionTypesSerializerc                    t        |       }|d k(  r-t        dt        j                  ddt        j                        S 	 t        j
                  j                         }t        |d      }t        |j                  t        j                  ddt        j                        S # t        $ rB}t        |       t        dt        j                  ddt        j                        cY d }~S d }~ww xY w)	NUser not login.messager   Fsafer   Tmany)vehicle_typesr   -Something went wrong. Please try again later.)r   r   r   HTTP_401_UNAUTHORIZEDr   objectsallr
   dataHTTP_200_OK	ExceptionprintHTTP_400_BAD_REQUEST)requestuser_idr   
serializeres        N/mnt/ACDE16A4DE16673C/PROJECTS/DRIVERZZ/DRIVERZZ_DRIVER_APIS/vehicles/views.pyvehicleTypesr$   	   s    7#G$'86C_C_`glu{  vR  vR  S  	S	u(00446M/DIJ*//VM_M_ `glu{  vH  vH  I  I 	u!H,[gm  hC  hC  !D  KP  Y_  Yt  Yt  u  u	us   A!B! !	C,*7C'!C,'C,c                    t        |       }|d k(  r-t        dt        j                  ddt        j                        S 	 t        j
                  j                         }t        |d      }t        |j                  t        j                  ddt        j                        S # t        $ r7}t        dt        j                  ddt        j                        cY d }~S d }~ww xY w)	Nr   r   Fr   Tr   )vehicle_modelsr   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r    r&   r!   r"   s        r#   vehicleModelsr'      s    7#G$'86C_C_`glu{  vR  vR  S  	S	u*22668N0dKJ:??fN`N` ahmv|  wI  wI  J  J 	u,[gm  hC  hC  !D  KP  Y_  Yt  Yt  u  u	u   A!B! !	C!*,CC!C!c                    t        |       }|d k(  r-t        dt        j                  ddt        j                        S 	 t        j
                  j                         }t        |d      }t        |j                  t        j                  ddt        j                        S # t        $ r7}t        dt        j                  ddt        j                        cY d }~S d }~ww xY w)	Nr   r   Fr   Tr   )transmission_typesr   r   )r   r   r   r   r	   r   r   r   r   r   r   r   )r   r    r*   r!   r"   s        r#   transmissionTypesr+   &   s    7#G$'86C_C_`glu{  vR  vR  S  	S	u!2!:!:!>!>!@;<NUYZJzRXRdRd elq  {A  {M  {M  N  N 	u,[gm  hC  hC  !D  KP  Y_  Yt  Yt  u  u	ur(   )authentication.authr   jsondjango.httpr   rest_frameworkr   modelsr   r   r	   serializersr
   r   r   r$   r'   r+        r#   <module>r4      s/    ,  $ ! B B l lu
u
ur3   