Pagination extension for flask-restful and flask-restplus
Project description
Flask Rest Paginate
A Pagination Extension for Flask RESTful and Flask RESTplus.
Installation
Install the extension using
pip install flask-rest-paginate
Usage
In your app, add the extension as follows
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_rest_paginate import Pagination
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///paginate-test.db"
db = SQLAlchemy(app)
pagination = Pagination(app, db)
Use in your project as
pagination.paginate(AuthorModel, author_schema)
You can also pass the sqlalchemy
query object as
pagination.paginate(AuthorModel.query.filter_by(id=author_id), author_schema)
If you want to use marshmallow schemas then set the third param True
pagination.paginate(AuthorModel, marshamllow_author_schema, True)
Example:
Check the example folder for an example of the extension.
Contributing
We are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.
You can report any bug you find or suggest new functionality with a new issue.
If you want to add yourself some functionality to the extension:
- Open an issue
- Comment there you are working on a new functionality
- Fork the repo
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Adds my new feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- mention the issue number in the PR description as
fixes #123, #321
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flask-rest-paginate-0.1.3.tar.gz
.
File metadata
- Download URL: flask-rest-paginate-0.1.3.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52b04c4599efab7c625bfaa536f4d53feb6acc8fde85fa37a10c8b63ae2c4bb9 |
|
MD5 | 4d7713853cf93a28f0c91493533f2d7b |
|
BLAKE2b-256 | 6208d113dc6f890fdf75a0e0c6c4ed4c4e6c3d8b7447d0c9abc5806c2dfad6b7 |
File details
Details for the file flask_rest_paginate-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: flask_rest_paginate-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e93a0c2ea11084f076e39505b76dadfabe88814e23daf5e8a10d385ca522cba |
|
MD5 | 93017e8eaf728b76951049dc3f5fe334 |
|
BLAKE2b-256 | 73b46cc44262adbd4fa1697ba4e149404da381cc43188ff0251d6da1afb91333 |