def get_previous_page_uri(request, page, page_size): if page > 2: return build_uri(request.path, request.query_string, page=page - 1) elif page == 2: return build_uri(request.path, request.query_string, page=None) else: return None
def get_next_page_uri(request, page, page_size, count): if page < ceil(count / page_size): return build_uri(request.path, request.query_string, page=page + 1) else: return None