From 6579d8e170fc21854b3e0357bd9626221bd16888 Mon Sep 17 00:00:00 2001 From: jang Date: Thu, 29 Aug 2019 05:36:58 +0900 Subject: [PATCH] Rename underscore2dash to dasherize_url --- rest_framework/decorators.py | 4 ++-- tests/test_decorators.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py index 9307b0d0b..41db023d5 100644 --- a/rest_framework/decorators.py +++ b/rest_framework/decorators.py @@ -120,7 +120,7 @@ def schema(view_inspector): return decorator -def action(methods=None, detail=None, url_path=None, url_name=None, underscore2dash=None, **kwargs): +def action(methods=None, detail=None, url_path=None, url_name=None, dasherize_url=None, **kwargs): """ Mark a ViewSet method as a routable action. @@ -145,7 +145,7 @@ def action(methods=None, detail=None, url_path=None, url_name=None, underscore2d if url_path: func.url_path = url_path else: - func.url_path = func.__name__.replace('_', '-') if underscore2dash else func.__name__ + func.url_path = func.__name__.replace('_', '-') if dasherize_url else func.__name__ func.url_name = url_name if url_name else func.__name__.replace('_', '-') func.kwargs = kwargs diff --git a/tests/test_decorators.py b/tests/test_decorators.py index 758001a7d..2a761f104 100644 --- a/tests/test_decorators.py +++ b/tests/test_decorators.py @@ -183,8 +183,8 @@ class ActionDecoratorTestCase(TestCase): 'description': 'Description', } - def test_underscore2dash(self): - @action(detail=True, underscore2dash=True) + def test_dasherize_url(self): + @action(detail=True, dasherize_url=True) def test_action(request): """Description"""