Pagination¶
API¶
-
twopi_flask_utils.pagination.
paginated
(basequery, schema_type, offset=None, limit=None)¶ Paginate a sqlalchemy query
Parameters: - basequery – The base query to be iterated upon
- schema_type – The
Marshmallow
schema to dump data with - offset – (Optional) The offset into the data. If omitted it will
be read from the query string in the
?offset=
argument. If not query string, defaults to 0. - limit – (Optional) The maximum results per page. If omitted it will
be read from the query string in the
?limit=
argument. If not query string, defaults to 20.
Returns: The page’s data in a namedtuple form
(data=, errors=)