{ "info": { "author": "Photocrowd, dtkav", "author_email": "me@danielgk.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Django cursor pagination [![Build Status](https://travis-ci.org/photocrowd/django-cursor-pagination.svg?branch=master)](https://travis-ci.org/photocrowd/django-cursor-pagination)\n========================\n\nTHIS IS A FORK\n========================\nThis is a fork of django-cursor-pagination, you probably don't want to use it.\nTry photocrowd/django-cursor-pagination instead.\n\nOriginal Readme\n========================\nA cursor based pagination system for Django. Instead of refering to specific\npages by number, we give every item in the queryset a cursor based on its\nordering values. We then ask for subsequent records by asking for records\n*after* the cursor of the last item we currently have. Similarly we can ask for\nrecords *before* the cursor of the first item to navigate back through the\nlist.\n\nThis approach has two major advantages over traditional pagination. Firstly, it\nensures that when new data is written into the table, records cannot be moved\nonto the next page. Secondly, it is much faster to query against the database\nas we are not using very large offset values.\n\nThere are some significant drawbacks over \"traditional\" pagination. The data\nmust be ordered by some database field(s) which are unique across all records.\nA typical use case would be ordering by a creation timestamp and an id. It is\nalso more difficult to get the range of possible pages for the data.\n\nThe inspiration for this project is largely taken from [this\npost](http://cra.mr/2011/03/08/building-cursors-for-the-disqus-api) by David\nCramer, and the connection spec for [Relay\nGraphQL](https://facebook.github.io/relay/graphql/connections.htm). Much of the\nimplementation is inspired by [Django rest framework's Cursor\npagination.](https://github.com/tomchristie/django-rest-framework/blob/9b56dda91850a07cfaecbe972e0f586434b965c3/rest_framework/pagination.py#L407-L707).\nThe main difference between the Disqus approach and the one used here is that\nwe require the ordering to be totally determinate instead of using offsets.\n\n\nInstallation\n------------\n\n```\npip install django-cursor-pagination\n```\n\nUsage\n-----\n\n```python\nfrom cursor_pagination import CursorPaginator\n\nfrom myapp.models import Post\n\n\ndef posts_api(request, after=None):\n qs = Post.objects.all()\n page_size = 10\n paginator = CursorPaginator(qs, ordering=('-created', '-id'))\n page = paginator.page(first=page_size, after=after)\n data = {\n 'objects': [serialize_page(p) for p in page],\n 'has_next_page': page.has_next,\n 'last_cursor': paginator.cursor(page[-1])\n }\n return data\n```\n\nReverse pagination can be achieved by using the `last` and `before` arguments\nto `paginator.page`.\n\nCaveats\n-------\n\n- The ordering specified **must** uniquely identify the object.\n- If there are multiple ordering fields, then they must all have the same\n direction\n- No support for multiple ordering fields in SQLite as it does not support\n tuple comparison.\n- If a cursor is given and it does not refer to a valid object, the values of\n `has_previous` (for `after`) or `has_next` (for `before`) will always return\n `True`.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dtkav/django-cursor-pagination", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-cursor-pagination-dtkav", "package_url": "https://pypi.org/project/django-cursor-pagination-dtkav/", "platform": "", "project_url": "https://pypi.org/project/django-cursor-pagination-dtkav/", "project_urls": { "Homepage": "https://github.com/dtkav/django-cursor-pagination" }, "release_url": "https://pypi.org/project/django-cursor-pagination-dtkav/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "Cursor based pagination for Django", "version": "0.1.7" }, "last_serial": 4734039, "releases": { "0.1.5": [ { "comment_text": "", "digests": { "md5": "55e63277f1395d7b550de8bb033f4376", "sha256": "f323b76fc3f1733c4e87ad48bcdb2b5d9bdda3bd736a876e3ce31b434ac2e123" }, "downloads": -1, "filename": "django_cursor_pagination_dtkav-0.1.5-py2-none-any.whl", "has_sig": false, "md5_digest": "55e63277f1395d7b550de8bb033f4376", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7243, "upload_time": "2019-01-23T03:52:48", "url": "https://files.pythonhosted.org/packages/f2/3e/d0a7620bb746441bc87b5a903197d6ebcd6c55ef52a46f6be9248f2f2f92/django_cursor_pagination_dtkav-0.1.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "42a8c4c50128410a807fb40910b3f9f7", "sha256": "bb5b99faaf435be49a503582bdf0cbf7ebf0e7b7f786a021b3e91bbdf7bcd700" }, "downloads": -1, "filename": "django-cursor-pagination-dtkav-0.1.5.tar.gz", "has_sig": false, "md5_digest": "42a8c4c50128410a807fb40910b3f9f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4502, "upload_time": "2019-01-23T03:52:50", "url": "https://files.pythonhosted.org/packages/e9/75/58fd4492fe175cb130b7fcf2c837059b598ed73ce017ab4cd933866f4f77/django-cursor-pagination-dtkav-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "186f64ac81cbdd805fb5d9457310beb8", "sha256": "9cd85bfb4d5f472fc9d5562e24d91a39dc11fc19e99b92bb6a4b20bff4cdc41d" }, "downloads": -1, "filename": "django_cursor_pagination_dtkav-0.1.6-py2-none-any.whl", "has_sig": false, "md5_digest": "186f64ac81cbdd805fb5d9457310beb8", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7276, "upload_time": "2019-01-23T04:11:36", "url": "https://files.pythonhosted.org/packages/d4/af/651a5730f4eddc4b822b245f8e9ac54fee2ef8b304e5ae587f9ad9e4c747/django_cursor_pagination_dtkav-0.1.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f7048868e1540c40424b8094ea4d7e1", "sha256": "1858d544ae0d8c1a098316229caa5ffe420de9091a339e7306ea0f450cbfd48b" }, "downloads": -1, "filename": "django-cursor-pagination-dtkav-0.1.6.tar.gz", "has_sig": false, "md5_digest": "7f7048868e1540c40424b8094ea4d7e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4540, "upload_time": "2019-01-23T04:11:37", "url": "https://files.pythonhosted.org/packages/ac/ec/efaa52d253559271f71d40c304e06610bbfa44d4c0daf7bd2072298cd2ad/django-cursor-pagination-dtkav-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "4c5f7c3d337e6c505da573a327c0a9d5", "sha256": "cac4b3a69c82b3eab7e0810359bb5f06d5dee214600cfddf7c365e8a352ee831" }, "downloads": -1, "filename": "django_cursor_pagination_dtkav-0.1.7-py2-none-any.whl", "has_sig": false, "md5_digest": "4c5f7c3d337e6c505da573a327c0a9d5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7541, "upload_time": "2019-01-24T03:54:49", "url": "https://files.pythonhosted.org/packages/24/43/4047abbbe6742d8a6f1079abc43c56d958c933c297b258194406ec91e4ff/django_cursor_pagination_dtkav-0.1.7-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45e74a753fe6f4e582863b2f8333116a", "sha256": "5a3703277fd14021ca0282da6a838c95dac724de8ae3cc095ddf942a810bb401" }, "downloads": -1, "filename": "django-cursor-pagination-dtkav-0.1.7.tar.gz", "has_sig": false, "md5_digest": "45e74a753fe6f4e582863b2f8333116a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4795, "upload_time": "2019-01-24T03:54:50", "url": "https://files.pythonhosted.org/packages/de/3b/4110719238c459535cec80b21993780bd3a95567c3cec2843456f82d2cb5/django-cursor-pagination-dtkav-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c5f7c3d337e6c505da573a327c0a9d5", "sha256": "cac4b3a69c82b3eab7e0810359bb5f06d5dee214600cfddf7c365e8a352ee831" }, "downloads": -1, "filename": "django_cursor_pagination_dtkav-0.1.7-py2-none-any.whl", "has_sig": false, "md5_digest": "4c5f7c3d337e6c505da573a327c0a9d5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7541, "upload_time": "2019-01-24T03:54:49", "url": "https://files.pythonhosted.org/packages/24/43/4047abbbe6742d8a6f1079abc43c56d958c933c297b258194406ec91e4ff/django_cursor_pagination_dtkav-0.1.7-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "45e74a753fe6f4e582863b2f8333116a", "sha256": "5a3703277fd14021ca0282da6a838c95dac724de8ae3cc095ddf942a810bb401" }, "downloads": -1, "filename": "django-cursor-pagination-dtkav-0.1.7.tar.gz", "has_sig": false, "md5_digest": "45e74a753fe6f4e582863b2f8333116a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4795, "upload_time": "2019-01-24T03:54:50", "url": "https://files.pythonhosted.org/packages/de/3b/4110719238c459535cec80b21993780bd3a95567c3cec2843456f82d2cb5/django-cursor-pagination-dtkav-0.1.7.tar.gz" } ] }