3
̜^                 @   s   d Z ddlmZmZmZmZ ddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZmZ ddlmZmZ ddlmZ G d	d
 d
ejZG dd dejZG dd dejZdS )z
App Api's
    )
AppVersionCityStateCountry)CitySerializerStateSerializerCountrySerializer)settings)Q)PrivateTokenAccessPermissionPublicTokenAccessPermission)genericsstatus)Responsec               @   s(   e Zd ZdZejjddZeZ	e
fZdS )CountryListAPIViewz
    Country List
    T)	is_activeN)__name__
__module____qualname____doc__r   objectsfilterquerysetr   serializer_classr   permission_classes r   r   6/home/hotel/hotelbackend/hotelapplication/app/views.pyr      s   r   c               @   s"   e Zd ZdZeZefZdd ZdS )StateListAPIViewz
    State List
    c             C   s2   t jjdd}d| jkr*|j| jd dS |S dS )uL  
        Returns the queryset that will be used to retrieve
        the object that this view will display.
        By default, get_queryset() returns the value of the
        queryset attribute if it is set, otherwise it constructs
        a QuerySet by calling the all() method on the model attribute’s default manager.
        T)r   country)Zcountry__pkN)r   r   r   kwargs)selfr   r   r   r   get_queryset!   s    
zStateListAPIView.get_querysetN)	r   r   r   r   r   r   r   r   r!   r   r   r   r   r      s   r   c               @   s"   e Zd ZdZeZefZdd ZdS )CityListAPIViewz
    City List
    c             C   s2   t jjdd}d| jkr*|j| jd dS |S dS )uL  
        Returns the queryset that will be used to retrieve
        the object that this view will display.
        By default, get_queryset() returns the value of the
        queryset attribute if it is set, otherwise it constructs
        a QuerySet by calling the all() method on the model attribute’s default manager.
        T)r   state)Z	state__pkN)r   r   r   r   )r    r   r   r   r   r!   6   s
    
zCityListAPIView.get_querysetN)	r   r   r   r   r   r   r   r   r!   r   r   r   r   r"   /   s   r"   N)r   
app.modelsr   r   r   r   app.serializersr   r   r   django.confr	   django.db.modelsr
   hotelmanage.core.permissionsr   r   rest_frameworkr   r   rest_framework.responser   ListAPIViewr   r   r"   r   r   r   r   <module>   s   