
    W8iI                     2    d dl mZ d dlmZ  G d de      Zy)    )Response)LimitOffsetPaginationc                   @     e Zd ZdZdZdZdZ fdZd fd	Zd Z	 xZ
S )	UnreadReadPagination
   limitoffsetd   c                 >    t         |           d | _        d | _        y N)super__init__filtered_qsunfiltered_qs)self	__class__s    U/var/www/html/dp2/backend_v2.1/server/apps/calls/pagination/unread_read_pagination.pyr   zUnreadReadPagination.__init__   s    !    c                 V    || _         |j                  | _        t        |   |||      S r   )r   r   r   paginate_queryset)r   querysetrequestviewr   s       r   r   z&UnreadReadPagination.paginate_queryset   s-    #!//w(7DAAr   c           
      "   | j                   j                  d      j                         }| j                   j                  d      j                         }t        | j                  ||z   ||| j	                         | j                         |d      S )NT)is_readF)counttotal
total_readtotal_unreadnextpreviousresults)r   filterr   r   get_next_linkget_previous_link)r   datar   r   s       r   get_paginated_responsez+UnreadReadPagination.get_paginated_response   s    ''..t.<BBD
))000?EEGZZ,.$(&&(..0
  	r   r   )__name__
__module____qualname__default_limitlimit_query_paramoffset_query_param	max_limitr   r   r'   __classcell__)r   s   @r   r   r      s)    M!I"
B
r   r   N)rest_framework.responser   utils.paginationsr   r    r   r   <module>r3      s    , 30 r   