          If request is not permitted, determine what kind of exception to raise.
          """
          if request.authenticators and not request.successful_authenticator:
              raise exceptions.NotAuthenticated()
          raise exceptions.PermissionDenied(detail=message)
  
      def throttled(self, request, wait):
          """
          If request is throttled, determine what kind of exception to raise.
          """
 
</s> remove     def permission_denied(self, request, message=None):
 </s> add     def permission_denied(self, request, message=None, code=None): </s> remove                     request, message=getattr(permission, 'message', None)
 </s> add                     request,
                    message=getattr(permission, 'message', None),
                    code=getattr(permission, 'code', None) </s> remove                     request, message=getattr(permission, 'message', None)
 </s> add                     request,
                    message=getattr(permission, 'message', None),
                    code=getattr(permission, 'code', None)
        raise exceptions.PermissionDenied(detail=message, code=code)
          If request is not permitted, determine what kind of exception to raise.
          """
          if request.authenticators and not request.successful_authenticator:
              raise exceptions.NotAuthenticated()
        raise exceptions.PermissionDenied(detail=message, code=code)
  
      def throttled(self, request, wait):
          """
          If request is throttled, determine what kind of exception to raise.
          """
keep keep keep keep replace keep keep keep keep keep
 Pass custom code to PermissionDenied if permission class had one set (#7306) 
rest_framework/views.py