Page info schema
This repository has been archived on 2023-03-02. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
2019-10-05 18:17:10 +03:00
marshmallow_pageinfo Initial commit 2019-10-05 18:17:10 +03:00
.gitignore Initial commit 2019-10-05 18:17:10 +03:00
LICENSE Initial commit 2019-10-05 18:17:10 +03:00
README.md Initial commit 2019-10-05 18:17:10 +03:00
requirements.txt Initial commit 2019-10-05 18:17:10 +03:00
setup.py Initial commit 2019-10-05 18:17:10 +03:00

marshmallow_pageinfo

Page info marshmallow schema for api

Installation

pip install -U marshmallow_pageinfo

Example

from marshmallow_pageinfo import PAGE_INFO_SCHEMA


@controller.route('/', methods=['GET'])
def get_todo():
	page_info = PAGE_INFO_SCHEMA.load(request.args)
	pagination = todo_q.paginate(page_info['page'], page_info['per_page'])
	return {
		'todos': TODO_SCHEMA.dump(pagination.items),
		'pageInfo': PAGE_INFO_SCHEMA.dump(pagination),
	}