mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 17:09:59 +03:00
Rename underscore2dash to dasherize_url
This commit is contained in:
parent
d11b569ef4
commit
6579d8e170
|
@ -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
|
||||
|
|
|
@ -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"""
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user