Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-rest-paginate-0.1.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

flask_rest_paginate-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file flask-rest-paginate-0.1.2.tar.gz.

File metadata

  • Download URL: flask-rest-paginate-0.1.2.tar.gz
  • Upload date:
  • Size: 4.2 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

Hashes for flask-rest-paginate-0.1.2.tar.gz
Algorithm Hash digest
SHA256 65b21b95de0bde401c5a53fd74404293900fa255ae7c6bb86cdf39df203674f6
MD5 39744472c214e843902b21d93705d5b0
BLAKE2b-256 2dfe058e57ba0cb1854778ba9706875bb77adc259be1ec6e8bdba2d887c22738

See more details on using hashes here.

File details

Details for the file flask_rest_paginate-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: flask_rest_paginate-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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

Hashes for flask_rest_paginate-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a43dcb6ff4a10c7969c270c226e749dafadaa5630c96bbeab5a00d40229d7494
MD5 d5746d0df8ba1d6069fd9469dfc08058
BLAKE2b-256 44bf7c9353adc3618d72eca7987ad86904118aa002931c17d4c24d33d849d641

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page