  
  
  class BasicPermWithDetail(permissions.BasePermission):
      message = 'Custom: You cannot access this resource'
  
      def has_permission(self, request, view):
          return False
  
 
</s>
    code = 'permission_denied_custom'
  
  
  class BasicPermWithDetail(permissions.BasePermission):
      message = 'Custom: You cannot access this resource'
    code = 'permission_denied_custom'
  
      def has_permission(self, request, view):
          return False
  
keep keep keep add keep keep keep keep
 Pass custom code to PermissionDenied if permission class had one set (#7306)
tests/test_permissions.py