{ "info": { "author": "mtShaikh", "author_email": "shaikh.taha95@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Flask", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3" ], "description": "# Flask Rest Paginate\n\nA Pagination Extension for Flask RESTful.\n\n## Installation\n\nInstall the extension using \n```\npip install flask-rest-paginate\n```\n\n## Usage\nIn your app, add the extension as follows\n\n```py\nfrom flask import Flask\nfrom flask_restful import Api\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_rest_paginate import Pagination\n\napp = Flask(__name__)\n\napp.config['SQLALCHEMY_DATABASE_URI'] = \"sqlite:///paginate-test.db\"\ndb = SQLAlchemy(app)\n\npagination = Pagination(app, db)\n\n```\n\nUse in your project as\n```py\npagination.paginate(AuthorModel, author_schema)\n```\n\nYou can also pass the `sqlalchemy` query object as\n```py\npagination.paginate(AuthorModel.query.filter_by(id=author_id), author_schema)\n```\n\nIf you want to use marshmallow schemas then set the third param `True`\n```py\npagination.paginate(AuthorModel, marshamllow_author_schema, True)\n```\n\n## Customize your pagination schema\n\nIf you want create a custom pagination schema. You should pass pagination_schema_hook and return a Dict with you custom schema\n```\nres = pagination.paginate(\n AuthorModel,\n schema,\n True,\n pagination_schema_hook=lambda current_page, page_obj: {\n \"next\": page_obj.has_next,\n \"prev\": page_obj.has_prev,\n \"current\": current_page,\n \"pages\": page_obj.pages,\n \"per_page\": page_obj.per_page,\n \"total\": page_obj.total,\n },\n )\n``` \n\nYou can also customize key names where data and pagination info are placed, setting the configuration variables:\n```\napp.config['PAGINATE_PAGINATION_OBJECT_KEY'] = \"page_info\"\napp.config['PAGINATE_DATA_OBJECT_KEY'] = \"results\"\n\n...\n\n{\n \"page_info\": {\n \"currentPage\": 1,\n \"hasNext\": false,\n \"hasPrev\": false,\n \"pages\": 1,\n \"size\": 20,\n \"totalElements\": 2\n }\n \"results\": {\n ...\n }\n}\n```\n\nFurthermore, pagination info can be moved directly to the root of the result object:\n```\napp.config['PAGINATE_PAGINATION_OBJECT_KEY'] = None\napp.config['PAGINATE_DATA_OBJECT_KEY'] = \"results\"\n\n...\n\n{\n \"currentPage\": 1,\n \"hasNext\": false,\n \"hasPrev\": false,\n \"pages\": 1,\n \"size\": 20,\n \"totalElements\": 2\n \"results\": {\n ...\n }\n}\n```\n\n## Example:\n\nCheck the [example](https://github.com/mtShaikh/flask-rest-paginate/tree/master/example) folder for an example of the extension.\n\n## Contributing\n\nWe are always grateful for any kind of contribution including but not limited to bug reports, code enhancements, bug fixes, and even functionality suggestions.\n\nYou can report any bug you find or suggest new functionality with a new [issue](https://github.com/mtShaikh/flask-rest-paginate/issues).\n\nIf you want to add yourself some functionality to the extension:\n\n- Open an [issue](https://github.com/mtShaikh/flask-rest-paginate/issues)\n- Comment there you are working on a new functionality\n- Fork the [repo](https://github.com/mtShaikh/flask-rest-paginate/)\n- Create your feature branch (git checkout -b my-new-feature)\n- Commit your changes (git commit -am 'Adds my new feature')\n- Push to the branch (git push origin my-new-feature)\n- Create a new Pull Request\n- mention the issue number in the PR description as `fixes #123, #321`\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mtShaikh/flask-rest-paginate", "keywords": "rest flask-restful pagination flask", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flask-rest-paginate", "package_url": "https://pypi.org/project/flask-rest-paginate/", "platform": "", "project_url": "https://pypi.org/project/flask-rest-paginate/", "project_urls": { "Homepage": "https://github.com/mtShaikh/flask-rest-paginate" }, "release_url": "https://pypi.org/project/flask-rest-paginate/1.1.3/", "requires_dist": [ "flask-sqlalchemy", "flask-restful" ], "requires_python": "", "summary": "Pagination extension for flask-restful", "version": "1.1.3", "yanked": false, "yanked_reason": null }, "last_serial": 10556778, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "51ca0936cb252477c17f8f0f348db11a", "sha256": "dd17ea05713d43c57edeecad5defa4b3f3bb9fe5f9139119c4b0c0ca349e12a7" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "51ca0936cb252477c17f8f0f348db11a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3633, "upload_time": "2019-10-30T19:56:28", "upload_time_iso_8601": "2019-10-30T19:56:28.562514Z", "url": "https://files.pythonhosted.org/packages/c5/27/b271dd4a65cc60c30423bfec67456eac9a9bf5d0a9b26aba4cd6f28e77a5/flask_rest_paginate-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "a7ba242f72920ba355b5993de8b7a813", "sha256": "57121e959214a2c6cb0303453a42da3cf7bbbae4a09933ac0b16c4138fa64364" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "a7ba242f72920ba355b5993de8b7a813", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4319, "upload_time": "2019-11-19T08:53:53", "upload_time_iso_8601": "2019-11-19T08:53:53.253567Z", "url": "https://files.pythonhosted.org/packages/5f/66/f32271f12398579defa11bcba14e8cf3ac9996115afdd6158405b799912d/flask_rest_paginate-0.1.1-py2-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "22c5b22b852ce7c944c48e6ab70fe6ad", "sha256": "06fd8bb630351eb83957e856de010869f6180f12166d1cfe0f2d6238abc9c713" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "22c5b22b852ce7c944c48e6ab70fe6ad", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4318, "upload_time": "2019-11-19T09:30:44", "upload_time_iso_8601": "2019-11-19T09:30:44.936285Z", "url": "https://files.pythonhosted.org/packages/e6/a4/123bff1df6c75d48fba7ea21eeb39afdeefdfb4e4fe77c72816139b35d1e/flask_rest_paginate-0.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "8bc762d6ac5d6afcd1ed21005adb9113", "sha256": "438fc82b4bb1d38d3f465d577c0275405028a1c08b97651268ed1e428cbee5cb" }, "downloads": -1, "filename": "flask-rest-paginate-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8bc762d6ac5d6afcd1ed21005adb9113", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4008, "upload_time": "2019-11-19T09:30:46", "upload_time_iso_8601": "2019-11-19T09:30:46.652463Z", "url": "https://files.pythonhosted.org/packages/cc/4b/a6c41146b8278f834b29a93d574a48721df2c6970bfaf2cdad1554fd7533/flask-rest-paginate-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d5746d0df8ba1d6069fd9469dfc08058", "sha256": "a43dcb6ff4a10c7969c270c226e749dafadaa5630c96bbeab5a00d40229d7494" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d5746d0df8ba1d6069fd9469dfc08058", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4452, "upload_time": "2019-11-19T09:55:50", "upload_time_iso_8601": "2019-11-19T09:55:50.803404Z", "url": "https://files.pythonhosted.org/packages/44/bf/7c9353adc3618d72eca7987ad86904118aa002931c17d4c24d33d849d641/flask_rest_paginate-0.1.2-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "39744472c214e843902b21d93705d5b0", "sha256": "65b21b95de0bde401c5a53fd74404293900fa255ae7c6bb86cdf39df203674f6" }, "downloads": -1, "filename": "flask-rest-paginate-0.1.2.tar.gz", "has_sig": false, "md5_digest": "39744472c214e843902b21d93705d5b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4196, "upload_time": "2019-11-19T09:55:52", "upload_time_iso_8601": "2019-11-19T09:55:52.553895Z", "url": "https://files.pythonhosted.org/packages/2d/fe/058e57ba0cb1854778ba9706875bb77adc259be1ec6e8bdba2d887c22738/flask-rest-paginate-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "93017e8eaf728b76951049dc3f5fe334", "sha256": "5e93a0c2ea11084f076e39505b76dadfabe88814e23daf5e8a10d385ca522cba" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "93017e8eaf728b76951049dc3f5fe334", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4358, "upload_time": "2019-11-19T10:15:51", "upload_time_iso_8601": "2019-11-19T10:15:51.430519Z", "url": "https://files.pythonhosted.org/packages/73/b4/6cc44262adbd4fa1697ba4e149404da381cc43188ff0251d6da1afb91333/flask_rest_paginate-0.1.3-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "4d7713853cf93a28f0c91493533f2d7b", "sha256": "52b04c4599efab7c625bfaa536f4d53feb6acc8fde85fa37a10c8b63ae2c4bb9" }, "downloads": -1, "filename": "flask-rest-paginate-0.1.3.tar.gz", "has_sig": false, "md5_digest": "4d7713853cf93a28f0c91493533f2d7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4109, "upload_time": "2019-11-19T10:15:53", "upload_time_iso_8601": "2019-11-19T10:15:53.100942Z", "url": "https://files.pythonhosted.org/packages/62/08/d113dc6f890fdf75a0e0c6c4ed4c4e6c3d8b7447d0c9abc5806c2dfad6b7/flask-rest-paginate-0.1.3.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "0648450e237897f052cc0a00ed8f3da0", "sha256": "f312bb8a9f32cc01eaad7a6345296c6f9750a45d2e52b316d105591232854936" }, "downloads": -1, "filename": "flask_rest_paginate-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "0648450e237897f052cc0a00ed8f3da0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4308, "upload_time": "2020-04-01T09:04:34", "upload_time_iso_8601": "2020-04-01T09:04:34.722477Z", "url": "https://files.pythonhosted.org/packages/8f/79/be5799140f8bcc83d27f117ed449811a5383a47b746c69a743e66f756815/flask_rest_paginate-0.1.5-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "c8c89a8882463fb385488352fd5065ed", "sha256": "573abd648ab47b727e240c657a75056c9fcf1c6b55bc8e35c4a77b8067074ae0" }, "downloads": -1, "filename": "flask_rest_paginate-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c8c89a8882463fb385488352fd5065ed", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4587, "upload_time": "2020-11-20T13:42:02", "upload_time_iso_8601": "2020-11-20T13:42:02.759366Z", "url": "https://files.pythonhosted.org/packages/d0/ef/73e29146cf3484496c88761214c57d1d2cd223cda3bc92a83e6c67fbc64c/flask_rest_paginate-1.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "22fc03fa3f9c7fb994af86dd111a0d62", "sha256": "d6df7cfbc40528e592fded2051f7e20e2bbb41245a6a30284a4673294b2cbd34" }, "downloads": -1, "filename": "flask_rest_paginate-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "22fc03fa3f9c7fb994af86dd111a0d62", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4603, "upload_time": "2021-01-05T18:49:36", "upload_time_iso_8601": "2021-01-05T18:49:36.928275Z", "url": "https://files.pythonhosted.org/packages/59/9e/1484f4121c52a70b9e5798bfae19f5ac1498e185e9daf67df7d73a6e03c6/flask_rest_paginate-1.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "856ae04317a657261431e8f2a4c3d608", "sha256": "ada8bb800318a94879b10205ccdead9206a6ac49adbe2c0efb43842450d93a2b" }, "downloads": -1, "filename": "flask_rest_paginate-1.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "856ae04317a657261431e8f2a4c3d608", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5481, "upload_time": "2021-02-02T08:01:23", "upload_time_iso_8601": "2021-02-02T08:01:23.356592Z", "url": "https://files.pythonhosted.org/packages/4b/f1/50e197a11863b0429989848e83d14d28a4a0d54909975754f5d43b4a9c67/flask_rest_paginate-1.1.2-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "f0f39102c7ab9f4b5d7f946731115ef1", "sha256": "cd8f88210e959b8a2339003f76e303ae221ba7df190bef8714b474aa9c4a3e9d" }, "downloads": -1, "filename": "flask_rest_paginate-1.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f0f39102c7ab9f4b5d7f946731115ef1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5801, "upload_time": "2021-06-04T09:54:27", "upload_time_iso_8601": "2021-06-04T09:54:27.451496Z", "url": "https://files.pythonhosted.org/packages/49/b8/8ffd1dc1447ada47f3329df37e0e8c9a5278c5f640e60d57784f41128327/flask_rest_paginate-1.1.3-py3-none-any.whl", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f0f39102c7ab9f4b5d7f946731115ef1", "sha256": "cd8f88210e959b8a2339003f76e303ae221ba7df190bef8714b474aa9c4a3e9d" }, "downloads": -1, "filename": "flask_rest_paginate-1.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f0f39102c7ab9f4b5d7f946731115ef1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5801, "upload_time": "2021-06-04T09:54:27", "upload_time_iso_8601": "2021-06-04T09:54:27.451496Z", "url": "https://files.pythonhosted.org/packages/49/b8/8ffd1dc1447ada47f3329df37e0e8c9a5278c5f640e60d57784f41128327/flask_rest_paginate-1.1.3-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }