def determine_actions(self, request, view):
        """Allow all allowed methods"""
        from rest_framework.generics import GenericAPIView
        actions = {}
        excluded_methods = {'HEAD', 'OPTIONS', 'PATCH', 'DELETE'}
        for method in set(view.allowed_methods) - excluded_methods:
            view.request = clone_request(request, method)
            try:
                if isinstance(view, GenericAPIView):
                    has_object = view.lookup_url_kwarg or view.lookup_field in view.kwargs
                elif method in {'PUT', 'POST'}:
                    has_object = method in {'PUT'}
                else:
                    continue
                # Test global permissions
                if hasattr(view, 'check_permissions'):
                    view.check_permissions(view.request)
                # Test object permissions
                if has_object and hasattr(view, 'get_object'):
                    view.get_object()
            except (exceptions.APIException, PermissionDenied, Http404):
                pass
            else:
                # If user has appropriate permissions for the view, include
                # appropriate metadata about the fields that should be supplied.
                serializer = view.get_serializer()
                actions[method] = self.get_serializer_info(serializer)
            finally:
                view.request = request

        return actions
def determine_actions ( self , request , view ) : from rest_framework . generics import GenericAPIView actions = { } excluded_methods = { 'HEAD' , 'OPTIONS' , 'PATCH' , 'DELETE' } for method in set ( view . allowed_methods ) - excluded_methods : view . request = clone_request ( request , method ) try : if isinstance ( view , GenericAPIView ) : has_object = view . lookup_url_kwarg or view . lookup_field in view . kwargs elif method in { 'PUT' , 'POST' } : has_object = method in { 'PUT' } else : continue if hasattr ( view , 'check_permissions' ) : view . check_permissions ( view . request ) if has_object and hasattr ( view , 'get_object' ) : view . get_object ( ) except ( exceptions . APIException , PermissionDenied , Http404 ) : pass else : serializer = view . get_serializer ( ) actions [ method ] = self . get_serializer_info ( serializer ) finally : view . request = request return actions
Allow all allowed methods