def filter_queryset(self, request, queryset, view):
        if 'child_of' in request.GET:
            try:
                parent_page_id = int(request.GET['child_of'])
                assert parent_page_id >= 0
            except (ValueError, __HOLE__):
                raise BadRequestError("child_of must be a positive integer")

            site_pages = pages_for_site(request.site)
            try:
                parent_page = site_pages.get(id=parent_page_id)
                queryset = queryset.child_of(parent_page)
                queryset._filtered_by_child_of = True
                return queryset
            except Page.DoesNotExist:
                raise BadRequestError("parent page doesn't exist")

        return queryset
dataset/ETHPy150Open torchbox/wagtail/wagtail/contrib/wagtailapi/filters.py/ChildOfFilter.filter_queryset