mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
Remove .link()
and .action()
decorators.
This commit is contained in:
parent
ce7b2cded9
commit
f87d32558e
|
@ -130,37 +130,3 @@ def list_route(methods=['get'], **kwargs):
|
||||||
func.kwargs = kwargs
|
func.kwargs = kwargs
|
||||||
return func
|
return func
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
# These are now pending deprecation, in favor of `detail_route` and `list_route`.
|
|
||||||
|
|
||||||
def link(**kwargs):
|
|
||||||
"""
|
|
||||||
Used to mark a method on a ViewSet that should be routed for detail GET requests.
|
|
||||||
"""
|
|
||||||
msg = 'link is pending deprecation. Use detail_route instead.'
|
|
||||||
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
|
|
||||||
|
|
||||||
def decorator(func):
|
|
||||||
func.bind_to_methods = ['get']
|
|
||||||
func.detail = True
|
|
||||||
func.kwargs = kwargs
|
|
||||||
return func
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
|
||||||
|
|
||||||
def action(methods=['post'], **kwargs):
|
|
||||||
"""
|
|
||||||
Used to mark a method on a ViewSet that should be routed for detail POST requests.
|
|
||||||
"""
|
|
||||||
msg = 'action is pending deprecation. Use detail_route instead.'
|
|
||||||
warnings.warn(msg, PendingDeprecationWarning, stacklevel=2)
|
|
||||||
|
|
||||||
def decorator(func):
|
|
||||||
func.bind_to_methods = methods
|
|
||||||
func.detail = True
|
|
||||||
func.kwargs = kwargs
|
|
||||||
return func
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user