Skip to content

icetemple/marshmallow_pageinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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),
	}