{ "info": { "author": "Greg Brown", "author_email": "greg@gregbrown.co.nz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "|Circle CI| |codecov| |Latest Version|\n\nPurpose\n-------\n\ndjango-next-prev provides utilities to get the next or previous item\nwithin an ordered, filtered queryset. For example, you could display a\nlink to the next featured post on a post detail page, or show\nchronological next and previous links for all published posts.\n\nInstallation\n------------\n\nDownload the source from https://pypi.python.org/pypi/django-next-prev/\nand run ``python setup.py install``, or:\n\n::\n\n > pip install django-next-prev\n\nDjango 1.8 or higher is required.\n\nQuick start\n-----------\n\nGiven this models.py:\n\n.. code:: python\n\n from django.db import models\n\n class Category(models.Model):\n title = models.CharField(max_length=100)\n\n class Post(models.Model):\n title = models.CharField(max_length=100)\n category = models.ForeignKey(Category, on_delete=models.CASCADE)\n created = models.DateField()\n text = models.TextField()\n\n class Meta:\n ordering = ('created', 'title')\n\nYou can do the following\n\n.. code:: python\n\n from next_prev import next_in_order, prev_in_order\n from .models import Post\n\n # default ordering\n first = Post.objects.first()\n second = next_in_order(first)\n prev_in_order(second) == first # True\n last = prev_in_order(first, loop=True)\n\n # custom ordering\n qs = Post.objects.all().order_by('-created')\n newest = qs.first()\n second_newest = next_in_order(newest, qs=qs)\n oldest = prev_in_order(newest, qs=qs, loop=True)\n\n.. |Circle CI| image:: https://circleci.com/gh/gregplaysguitar/django-next-prev.svg?style=svg\n :target: https://circleci.com/gh/gregplaysguitar/django-next-prev\n.. |codecov| image:: https://codecov.io/gh/gregplaysguitar/django-next-prev/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/gregplaysguitar/django-next-prev\n.. |Latest Version| image:: https://img.shields.io/pypi/v/django-next-prev.svg?style=flat\n :target: https://pypi.python.org/pypi/django-next-prev/\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/gregplaysguitar/django-next-prev", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "django-next-prev", "package_url": "https://pypi.org/project/django-next-prev/", "platform": "any", "project_url": "https://pypi.org/project/django-next-prev/", "project_urls": { "Homepage": "https://github.com/gregplaysguitar/django-next-prev" }, "release_url": "https://pypi.org/project/django-next-prev/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Django utility to retrieve the next or previous object, given a current object and a queryset.", "version": "1.0.1" }, "last_serial": 2824445, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "b3e8b5df065fd31f26159cf8b9b1d510", "sha256": "52b830711cbf85e49c2406c16d8683b7a872817a3c795f7e9485cb8bc1ef6dde" }, "downloads": -1, "filename": "django-next-prev-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b3e8b5df065fd31f26159cf8b9b1d510", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3566, "upload_time": "2017-04-23T23:57:48", "url": "https://files.pythonhosted.org/packages/38/3b/12f85bed3e714aac2b30cd10b6e25497cae6d481ae4e1d80e91d86764fec/django-next-prev-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ac8b86dba11babbb3e2f6353e9d150ed", "sha256": "5fe2c693db551c0f444cb82284335a0e303518215050b3cb56551abb251e9376" }, "downloads": -1, "filename": "django-next-prev-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ac8b86dba11babbb3e2f6353e9d150ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4162, "upload_time": "2017-04-24T01:41:15", "url": "https://files.pythonhosted.org/packages/69/eb/17a4714af8a67f654a9083946ea694e283fa065d876df67fbd30a89dcd25/django-next-prev-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ac8b86dba11babbb3e2f6353e9d150ed", "sha256": "5fe2c693db551c0f444cb82284335a0e303518215050b3cb56551abb251e9376" }, "downloads": -1, "filename": "django-next-prev-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ac8b86dba11babbb3e2f6353e9d150ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4162, "upload_time": "2017-04-24T01:41:15", "url": "https://files.pythonhosted.org/packages/69/eb/17a4714af8a67f654a9083946ea694e283fa065d876df67fbd30a89dcd25/django-next-prev-1.0.1.tar.gz" } ] }