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

    Usage::

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

            @list_route(methods=['get'], url_path='active-users')
            def active_users(request, *args, **kwargs):
                ...

    :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 list_route(methods=None, **kwargs):
    """
    Used to mark a method on a ViewSet that should be routed for list requests.

    Usage::

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

            @list_route(methods=['get'], url_path='active-users')
            def active_users(request, *args, **kwargs):
                ...

    :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 = False
        func.kwargs = kwargs

        return func

    return decorator