  
      def decorator(func):
          func.bind_to_methods = methods
          func.detail = detail
          func.url_path = url_path or func.__name__
          func.url_name = url_name or func.__name__.replace('_', '-')
          func.kwargs = kwargs
          return func
      return decorator
  
  
 
</s> remove     return action(methods, detail=False, **kwargs)
 </s> add     def decorator(func):
        func = action(methods, detail=False, **kwargs)(func)
        if 'url_name' not in kwargs:
            func.url_name = func.url_path.replace('_', '-')
        return func
    return decorator </s> remove     return action(methods, detail=True, **kwargs)
 </s> add     def decorator(func):
        func = action(methods, detail=True, **kwargs)(func)
        if 'url_name' not in kwargs:
            func.url_name = func.url_path.replace('_', '-')
        return func
    return decorator
        func.url_path = url_path if url_path else func.__name__
        func.url_name = url_name if url_name else func.__name__.replace('_', '-')
  
      def decorator(func):
          func.bind_to_methods = methods
          func.detail = detail
        func.url_path = url_path if url_path else func.__name__
        func.url_name = url_name if url_name else func.__name__.replace('_', '-')
        func.url_path = url_path if url_path else func.__name__
        func.url_name = url_name if url_name else func.__name__.replace('_', '-')
          func.kwargs = kwargs
          return func
      return decorator
  
  
keep keep keep keep replace replace keep keep keep keep keep
 Use old url_name behavior in route decorators (#5915)

* Wrap action decorator for old url_name behavior 
rest_framework/decorators.py