
    h'                     ~   S r SSKJr  SSKJr  SSKJr  SSKJr	  SSK
JrJr  SSKJr  S r " S	 S
\R                  5      r " S S\R"                  \5      r " S S\R&                  \5      r " S S\R*                  \5      r " S S\R.                  \5      r " S S\R2                  \5      r " S S\R&                  \R"                  \5      r " S S\R*                  \R2                  \5      r " S S\R*                  \R.                  \5      r " S S\R*                  \R2                  \R.                  \5      rg)z7
Generic views that provide commonly needed behaviour.
    )ValidationError)QuerySet)Http404)get_object_or_404)mixinsviews)api_settingsc                 `     [        U /UQ70 UD6$ ! [        [        [        4 a    [        ef = f)zz
Same as Django's standard shortcut, but make sure to also raise 404
if the filter_kwargs don't match the required types.
)_get_object_or_404	TypeError
ValueErrorr   r   )querysetfilter_argsfilter_kwargss      I/var/www/html/env/lib/python3.13/site-packages/rest_framework/generics.pyr   r      s7    
!(J[JMJJz?3 s    -c                       \ rS rSrSrSrSrSrSr\	R                  r\	R                  rS rS rS rS rS	 rS
 rS r\S 5       rS rS rSrg)GenericAPIView   z)
Base class for all other generic views.
Npkc                     U $ N )clsargskwargss      r   __class_getitem__ GenericAPIView.__class_getitem__1   s    
    c                     U R                   c   SU R                  R                  -  5       eU R                   n[        U[        5      (       a  UR                  5       nU$ )a  
Get the list of items for this view.
This must be an iterable, and may be a queryset.
Defaults to using `self.queryset`.

This method should always be used rather than accessing `self.queryset`
directly, as `self.queryset` gets evaluated only once, and those results
are cached for all subsequent requests.

You may want to override this if you need to provide different
querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)
z['%s' should either include a `queryset` attribute, or override the `get_queryset()` method.)r   	__class____name__
isinstancer   allselfr   s     r   get_querysetGenericAPIView.get_queryset4   sZ     }}( 	
7nn%%&	
( ==h))||~Hr   c                 n   U R                  U R                  5       5      nU R                  =(       d    U R                  nX R                  ;   d$   SU R
                  R                  < SU< S35       eU R                  U R                  U   0n[        U40 UD6nU R                  U R                  U5        U$ )z
Returns the object the view is displaying.

You may want to override this if you need to provide non-standard
queryset lookups.  Eg if objects are referenced using multiple
keyword arguments in the url conf.
zExpected view z1 to be called with a URL keyword argument named "zQ". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.)
filter_querysetr&   lookup_url_kwarglookup_fieldr   r    r!   r   check_object_permissionsrequest)r%   r   r*   r   objs        r   
get_objectGenericAPIView.get_objectO   s     ''(9(9(;<  00ED4E4E;;. 	
 ^^$$&68	
. **DKK8H,IJ:M: 	%%dllC8
r   c                 r    U R                  5       nUR                  SU R                  5       5        U" U0 UD6$ )zx
Return the serializer instance that should be used for validating and
deserializing input, and for serializing output.
context)get_serializer_class
setdefaultget_serializer_context)r%   r   r   serializer_classs       r   get_serializerGenericAPIView.get_serializerk   s<    
  446)T%@%@%BC000r   c                 p    U R                   c   SU R                  R                  -  5       eU R                   $ )a  
Return the class to use for the serializer.
Defaults to using `self.serializer_class`.

You may want to override this if you need to provide different
serializations depending on the incoming request.

(Eg. admins get full serialization, others get basic serialization)
zk'%s' should either include a `serializer_class` attribute, or override the `get_serializer_class()` method.)r6   r    r!   r%   s    r   r3   #GenericAPIView.get_serializer_classt   sB     $$0 	
?nn%%&	
0 $$$r   c                 6    U R                   U R                  U S.$ )z1
Extra context provided to the serializer class.
)r-   formatview)r-   format_kwargr:   s    r   r5   %GenericAPIView.get_serializer_context   s!    
 ||''
 	
r   c                     [        U R                  5       H$  nU" 5       R                  U R                  X5      nM&     U$ )a'  
Given a queryset, filter it with whichever filter backend is in use.

You are unlikely to want to override this method, although you may need
to call it either from a list view, or from a custom `get_object`
method if you want to apply the configured filtering backend to the
default queryset.
)listfilter_backendsr)   r-   )r%   r   backends      r   r)   GenericAPIView.filter_queryset   s6     D001Gy00xNH 2r   c                     [        U S5      (       d5  U R                  c  SU l        U R                  $ U R                  5       U l        U R                  $ )z=
The paginator instance associated with the view, or `None`.

_paginatorN)hasattrpagination_classrG   r:   s    r   	paginatorGenericAPIView.paginator   sL    
 t\**$$,"&  #'"7"7"9r   c                 f    U R                   c  gU R                   R                  XR                  U S9$ )zG
Return a single page of results, or `None` if pagination is disabled.
N)r>   )rJ   paginate_querysetr-   r$   s     r   rM    GenericAPIView.paginate_queryset   s/     >>!~~//,,T/RRr   c                 V    U R                   c   eU R                   R                  U5      $ )zG
Return a paginated style `Response` object for the given output data.
)rJ   get_paginated_response)r%   datas     r   rP   %GenericAPIView.get_paginated_response   s)     ~~)))~~44T::r   )rG   )r!   
__module____qualname____firstlineno____doc__r   r6   r+   r*   r	   DEFAULT_FILTER_BACKENDSrC   DEFAULT_PAGINATION_CLASSrI   r   r&   r/   r7   r3   r5   r)   propertyrJ   rM   rP   __static_attributes__r   r   r   r   r      s~     H L #::O $<<681%$
 	 	S;r   r   c                       \ rS rSrSrS rSrg)CreateAPIView   z.
Concrete view for creating a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   creater%   r-   r   r   s       r   postCreateAPIView.post       {{74T4V44r   r   N)r!   rS   rT   rU   rV   rb   rZ   r   r   r   r\   r\      s    5r   r\   c                       \ rS rSrSrS rSrg)ListAPIView   z'
Concrete view for listing a queryset.
c                 .    U R                   " U/UQ70 UD6$ r   rB   ra   s       r   getListAPIView.get       yy242622r   r   Nr!   rS   rT   rU   rV   rj   rZ   r   r   r   rf   rf      s    3r   rf   c                       \ rS rSrSrS rSrg)RetrieveAPIView   z0
Concrete view for retrieving a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   retrievera   s       r   rj   RetrieveAPIView.get       }}W6t6v66r   r   Nrm   r   r   r   ro   ro      s    7r   ro   c                       \ rS rSrSrS rSrg)DestroyAPIView   z.
Concrete view for deleting a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   destroyra   s       r   deleteDestroyAPIView.delete       ||G5d5f55r   r   N)r!   rS   rT   rU   rV   r|   rZ   r   r   r   rw   rw      s    6r   rw   c                   $    \ rS rSrSrS rS rSrg)UpdateAPIView   z.
Concrete view for updating a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   updatera   s       r   putUpdateAPIView.put   rd   r   c                 .    U R                   " U/UQ70 UD6$ r   partial_updatera   s       r   patchUpdateAPIView.patch       ""7<T<V<<r   r   N)r!   rS   rT   rU   rV   r   r   rZ   r   r   r   r   r      s    5=r   r   c                   $    \ rS rSrSrS rS rSrg)ListCreateAPIView   zD
Concrete view for listing a queryset or creating a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   ri   ra   s       r   rj   ListCreateAPIView.get   rl   r   c                 .    U R                   " U/UQ70 UD6$ r   r_   ra   s       r   rb   ListCreateAPIView.post   rd   r   r   N)r!   rS   rT   rU   rV   rj   rb   rZ   r   r   r   r   r      s    35r   r   c                   *    \ rS rSrSrS rS rS rSrg)RetrieveUpdateAPIView   z:
Concrete view for retrieving, updating a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   rr   ra   s       r   rj   RetrieveUpdateAPIView.get   ru   r   c                 .    U R                   " U/UQ70 UD6$ r   r   ra   s       r   r   RetrieveUpdateAPIView.put  rd   r   c                 .    U R                   " U/UQ70 UD6$ r   r   ra   s       r   r   RetrieveUpdateAPIView.patch  r   r   r   N)	r!   rS   rT   rU   rV   rj   r   r   rZ   r   r   r   r   r      s    75=r   r   c                   $    \ rS rSrSrS rS rSrg)RetrieveDestroyAPIViewi	  z<
Concrete view for retrieving or deleting a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   rr   ra   s       r   rj   RetrieveDestroyAPIView.get  ru   r   c                 .    U R                   " U/UQ70 UD6$ r   rz   ra   s       r   r|   RetrieveDestroyAPIView.delete  r~   r   r   N)r!   rS   rT   rU   rV   rj   r|   rZ   r   r   r   r   r   	  s    76r   r   c                   0    \ rS rSrSrS rS rS rS rSr	g)	RetrieveUpdateDestroyAPIViewi  zF
Concrete view for retrieving, updating or deleting a model instance.
c                 .    U R                   " U/UQ70 UD6$ r   rr   ra   s       r   rj    RetrieveUpdateDestroyAPIView.get  ru   r   c                 .    U R                   " U/UQ70 UD6$ r   r   ra   s       r   r    RetrieveUpdateDestroyAPIView.put   rd   r   c                 .    U R                   " U/UQ70 UD6$ r   r   ra   s       r   r   "RetrieveUpdateDestroyAPIView.patch#  r   r   c                 .    U R                   " U/UQ70 UD6$ r   rz   ra   s       r   r|   #RetrieveUpdateDestroyAPIView.delete&  r~   r   r   N)
r!   rS   rT   rU   rV   rj   r   r   r|   rZ   r   r   r   r   r     s    75=6r   r   N)rV   django.core.exceptionsr   django.db.models.queryr   django.httpr   django.shortcutsr   r   rest_frameworkr   r   rest_framework.settingsr	   APIViewr   CreateModelMixinr\   ListModelMixinrf   RetrieveModelMixinro   DestroyModelMixinrw   UpdateModelMixinr   r   r   r   r   r   r   r   <module>r      s    3 +  D ( 0^;U]] ^;H5F++"53&'' 37f//$76V--#6	=F++"	=
5--//&
5=F55"33*= 
6V66#55+
666#<#<#)#:#:#)#;#;#16r   