Used to mark a method on a ViewSet that should be routed for detail requests.

    Usage::

        class UserViewSet(ModelCRUDViewSet):
            model = User
            schema = UserSchema

            @detail_route(methods=['post'], url_path='lock-user')
            def lock_user(request, id):
                ...

    :param methods: An iterable of strings representing the HTTP (GET, POST, etc.) methods accepted by the route.
    :param url_path: Replaces the route automatically generated by the ViewSetRouter for the decorated method
                     with the value provided.

def detail_route(methods=None, **kwargs):
    """
    Used to mark a method on a ViewSet that should be routed for detail requests.

    Usage::

        class UserViewSet(ModelCRUDViewSet):
            model = User
            schema = UserSchema

            @detail_route(methods=['post'], url_path='lock-user')
            def lock_user(request, id):
                ...

    :param methods: An iterable of strings representing the HTTP (GET, POST, etc.) methods accepted by the route.
    :param url_path: Replaces the route automatically generated by the ViewSetRouter for the decorated method
                     with the value provided.
    """
    methods = ['get'] if (methods is None) else methods

    def decorator(func):
        func.bind_to_methods = methods
        func.detail = True
        func.kwargs = kwargs

        return func

    return decorator