
    	h                     J    d dl mZ d dlmZ d dlmZ ddlmZ  G d de      Zy)	    )APIView)Responsestatus   )Shopc                       e Zd ZdZd Zy)ShopListViewz4
    View to list all shops with their details.
    c                 @   	 t         j                  j                  d      }g }|D ]  }|j                  |j                  |j
                  |j                  |j                  |j                  |j                  |j                  |j                  d|j                  |j                  |j                  |j                  d        t!        dd|dt"        j$                        S # t&        $ r2}t!        dd	t)        |      d
t"        j*                        cY d }~S d }~ww xY w)NOpenr   )streetcitydistrictstate_or_provincepin_code)uuid	unit_nameunit_locationaddresslatitude	longitude
contact_noemailr   zShops retrieved successfully.)r   messageshopsr   zAn unexpected error occurred.)r   r   	Exception)r   objectsfilterappendr   r   r   r   r   r   r   r   r   r   r   r   r   r   HTTP_200_OKr   strHTTP_400_BAD_REQUEST)selfrequestr   	shop_listshopes         -E:\Akash\Saasvaap\Navya-Bakers\shops\views.pygetzShopListView.get   s   (	LL''v'6EI   II!%%)%7%7"&++ $		$(MM-1-C-C$(MM  !%!%"&//!ZZ"  & >&
 ))   	>!$Q
 22 	s   CC" "	D+'DDDN)__name__
__module____qualname____doc__r)        r(   r
   r
      s    )r/   r
   N)	rest_framework.viewsr   rest_framework.responser   rest_frameworkr   modelsr   r
   r.   r/   r(   <module>r4      s    ( , ! .7 .r/   