Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit27a2e93

Browse files
author
Ryan P Kilby
committed
Add name/desc override to action
1 parent2ab9ba1 commit27a2e93

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎rest_framework/decorators.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
importtypes
1212
importwarnings
1313

14+
fromdjango.forms.utilsimportpretty_name
1415
fromdjango.utilsimportsix
1516

1617
fromrest_framework.viewsimportAPIView
@@ -130,7 +131,7 @@ def decorator(func):
130131
returndecorator
131132

132133

133-
defaction(methods=None,detail=True,url_name=None,url_path=None,**kwargs):
134+
defaction(methods=None,detail=True,name=None,url_name=None,url_path=None,**kwargs):
134135
"""
135136
Mark a ViewSet method as a routable action.
136137
@@ -146,6 +147,11 @@ def decorator(func):
146147
func.url_name=url_nameorfunc.__name__
147148
func.url_path=url_pathorfunc.__name__
148149
func.kwargs=kwargs
150+
func.kwargs.update({
151+
'name':nameorpretty_name(func.__name__),
152+
'description':func.__doc__orNone
153+
})
154+
149155
returnfunc
150156
returndecorator
151157

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp