mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Commenting link/action decorators as pending deprecation
This commit is contained in:
		
							parent
							
								
									4292cc18fa
								
							
						
					
					
						commit
						8acee2e626
					
				| 
						 | 
				
			
			@ -108,6 +108,31 @@ def permission_classes(permission_classes):
 | 
			
		|||
    return decorator
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def detail_route(methods=['get'], **kwargs):
 | 
			
		||||
    """
 | 
			
		||||
    Used to mark a method on a ViewSet that should be routed for detail requests.
 | 
			
		||||
    """
 | 
			
		||||
    def decorator(func):
 | 
			
		||||
        func.bind_to_methods = methods
 | 
			
		||||
        func.detail = True
 | 
			
		||||
        func.kwargs = kwargs
 | 
			
		||||
        return func
 | 
			
		||||
    return decorator
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def list_route(methods=['get'], **kwargs):
 | 
			
		||||
    """
 | 
			
		||||
    Used to mark a method on a ViewSet that should be routed for list requests.
 | 
			
		||||
    """
 | 
			
		||||
    def decorator(func):
 | 
			
		||||
        func.bind_to_methods = methods
 | 
			
		||||
        func.detail = False
 | 
			
		||||
        func.kwargs = kwargs
 | 
			
		||||
        return func
 | 
			
		||||
    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.
 | 
			
		||||
| 
						 | 
				
			
			@ -134,27 +159,3 @@ def action(methods=['post'], **kwargs):
 | 
			
		|||
        func.kwargs = kwargs
 | 
			
		||||
        return func
 | 
			
		||||
    return decorator
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def detail_route(methods=['get'], **kwargs):
 | 
			
		||||
    """
 | 
			
		||||
    Used to mark a method on a ViewSet that should be routed for detail requests.
 | 
			
		||||
    """
 | 
			
		||||
    def decorator(func):
 | 
			
		||||
        func.bind_to_methods = methods
 | 
			
		||||
        func.detail = True
 | 
			
		||||
        func.kwargs = kwargs
 | 
			
		||||
        return func
 | 
			
		||||
    return decorator
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def list_route(methods=['get'], **kwargs):
 | 
			
		||||
    """
 | 
			
		||||
    Used to mark a method on a ViewSet that should be routed for list requests.
 | 
			
		||||
    """
 | 
			
		||||
    def decorator(func):
 | 
			
		||||
        func.bind_to_methods = methods
 | 
			
		||||
        func.detail = False
 | 
			
		||||
        func.kwargs = kwargs
 | 
			
		||||
        return func
 | 
			
		||||
    return decorator
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user