Rename underscore2dash to dasherize_url

This commit is contained in:
jang 2019-08-29 05:36:58 +09:00
parent d11b569ef4
commit 6579d8e170
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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"""