{ "info": { "author": "James Pacileo", "author_email": "jamespacileo@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: WSGI", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "======================\ndjango-pure-pagination\n======================\n\n.. image:: https://travis-ci.org/hovel/django-pure-pagination.svg?branch=master\n :target: https://travis-ci.org/hovel/django-pure-pagination\n\nDescription\n======================\n\n:Author:\n James Pacileo `@ignighted `_\n\n:Version:\n 0.3.0\n\n:Description:\n django-pure-pagination provides advanced pagination features and is fully compatible with existing code based on Django's core pagination module. (aka no need to rewrite code!)\n\n:Requirements:\n Django 1.7+\n\n:Contributors:\n `juandecarrion (Juande Carrion) `_, `twidi (St\u00e9phane Angel) `_, `bebraw (Juho Veps\u00e4l\u00e4inen) `_, `lampslave () `_, `GeyseR (Sergey Fursov) `_, `zeus (Pavel Zhukov) `_\n\n\nIntroduction\n============\n\nThe django app offers advanced pagination features without forcing major code changes within an existing project.\n\nDjango-pure-pagination is based upon Django's core pagination module and is therefore compatible with the existing api.\n\n`Documentation for Django core pagination module `_\n\nFeatures\n--------\n\n1. Uses same API as **django.core.pagination** and therefore is fully compatible with existing code.\n\n2. Has dynamic query string creation, which takes into consideration existing GET parameters.\n\n3. Out-of-the-box html rendering of the pagination\n\n4. Additional methods make it easier to render more advanced pagination templates.\n\n\nInstallation\n------------\n\nInstall package from PYPI:\n\n::\n\n pip install django-pure-pagination\n\nor clone and install from repository:\n\n::\n\n git clone git@github.com:jamespacileo/django-pure-pagination.git\n cd django-pure-pagination\n python setup.py install\n\nAdd `pure_pagination` to INSTALLED_APPS\n\n::\n\n INSTALLED_APPS = (\n ...\n 'pure_pagination',\n )\n\nFinally substitute **from django.core.paginator import Paginator** with **from pure_pagination import Paginator**\n\nSettings\n--------\n\nA few settings can be set within settings.py\n\n::\n\n PAGINATION_SETTINGS = {\n 'PAGE_RANGE_DISPLAYED': 10,\n 'MARGIN_PAGES_DISPLAYED': 2,\n\n 'SHOW_FIRST_PAGE_WHEN_INVALID': True,\n }\n\n**PAGE_RANGE_DISPLAYED** is the number of pages neighbouring the current page which will be displayed (default is 10)\n\n**MARGIN_PAGES_DISPLAYED** is the number of pages neighbouring the first and last page which will be displayed (default is 2)\n\nSet **SHOW_FIRST_PAGE_WHEN_INVALID** to True when you want to just show first page when provided invalid page instead of 404 error\n\n.. image:: http://i.imgur.com/LCqrt.gif\n\nUsage example\n-------------\n\nFollowing is a simple example for **function based views**. For generic class-based views, see bellow.\n\nview file: **views.py**\n\n::\n\n # views.py\n from django.shortcuts import render_to_response\n\n from pure_pagination import Paginator, EmptyPage, PageNotAnInteger\n\n\n def index(request):\n\n try:\n page = request.GET.get('page', 1)\n except PageNotAnInteger:\n page = 1\n\n objects = ['john', 'edward', 'josh', 'frank']\n\n # Provide Paginator with the request object for complete querystring generation\n\n p = Paginator(objects, request=request)\n\n people = p.page(page)\n\n return render_to_response('index.html', {\n 'people': people,\n }\n\n\ntemplate file: **index.html**\n\n::\n\n {# index.html #}\n {% extends 'base.html' %}\n\n {% block content %}\n\n {% for person in people.object_list %}\n
\n First name: {{ person }}\n
\n {% endfor %}\n\n {# The following renders the pagination html #}\n
\n {{ people.render }}\n
\n\n {% endblock %}\n\n\nUsage\n-----\n\nThere a few different way you can make use of the features introduced within django-pure-pagination.\n\nEasiest way to render the pagination is to call the render method i.e. **{{ page.render }}**\n\nAlternatively you can access the Page object low level methods yourself\n\n**Special note:** **page_obj** and **current_page** both point to the page object within the template.\n\n::\n\n {% load i18n %}\n
\n {% if page_obj.has_previous %}\n ‹‹ {% trans \"previous\" %}\n {% else %}\n ‹‹ {% trans \"previous\" %}\n {% endif %}\n {% for page in page_obj.pages %}\n {% if page %}\n {% ifequal page page_obj.number %}\n {{ page }}\n {% else %}\n {{ page }}\n {% endifequal %}\n {% else %}\n ...\n {% endif %}\n {% endfor %}\n {% if page_obj.has_next %}\n {% trans \"next\" %} ››\n {% else %}\n {% trans \"next\" %} ››\n {% endif %}\n
\n\nGeneric Class-Based Views\n-------------------------\n\nDocumentation for Django generic class-based views on https://docs.djangoproject.com/en/dev/ref/class-based-views/\n\n\nview file:\n\n* **views.py**\n\n ::\n\n # views.py\n from django.views.generic import ListView\n\n from pure_pagination.mixins import PaginationMixin\n\n from my_app.models import MyModel\n\n\n class MyModelListView(PaginationMixin, ListView):\n # Important, this tells the ListView class we are paginating\n paginate_by = 10\n\n # Replace it for your model or use the queryset attribute instead\n object = MyModel\n\ntemplate files:\n\nNote that the Django generic-based list view will include the object **page_obj** in the context. More information on https://docs.djangoproject.com/en/dev/ref/generic-views/#list-detail-generic-views\n\n* **_pagination.html**\n\n ::\n\n {% load i18n %}\n
\n {% if page_obj.has_previous %}\n ‹‹ {% trans \"previous\" %}\n {% else %}\n ‹‹ {% trans \"previous\" %}\n {% endif %}\n {% for page in page_obj.pages %}\n {% if page %}\n {% ifequal page page_obj.number %}\n {{ page }}\n {% else %}\n {{ page }}\n {% endifequal %}\n {% else %}\n ...\n {% endif %}\n {% endfor %}\n {% if page_obj.has_next %}\n {% trans \"next\" %} ››\n {% else %}\n {% trans \"next\" %} ››\n {% endif %}\n
\n\n* **my_app/myobject_list.html**\n\n ::\n\n {# my_app/myobject_list.html #}\n {% extends 'base.html' %}\n\n {% block content %}\n\n {% for object in object_list %}\n
\n First name: {{ object.first_name }}\n
\n {% endfor %}\n\n {# The following renders the pagination html #}\n {% include \"_pagination.html\" %}\n\n {% endblock %}", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jamespacileo/django-pure-pagination/", "keywords": "pagination,django", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-pure-pagination", "package_url": "https://pypi.org/project/django-pure-pagination/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-pure-pagination/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/jamespacileo/django-pure-pagination/" }, "release_url": "https://pypi.org/project/django-pure-pagination/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "django-pure-pagination provides advanced pagination features\n and is fully compatible with existing code based on Django's\n core \n pagination module. (aka no need to rewrite code!)", "version": "0.3.0" }, "last_serial": 1878363, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f6ed83aabec370e72850498689711979", "sha256": "5f3fc2ad65861fdfa12d577196885954f7f6be0d00fd3dc08a9edb7dbf01b138" }, "downloads": -1, "filename": "django-pure-pagination-0.1.zip", "has_sig": false, "md5_digest": "f6ed83aabec370e72850498689711979", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11937, "upload_time": "2011-04-19T16:35:11", "url": "https://files.pythonhosted.org/packages/5c/b0/81821a2e2f935be5d66b1e0f1a10c362113149acc22316c79765f446d5a2/django-pure-pagination-0.1.zip" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "7b9b58c7252f76684ecd6b47343c9805", "sha256": "cf2d1694aedb03cc743f1378ae4ce41ff1e40d6b7aefe198f128dcb888780913" }, "downloads": -1, "filename": "django-pure-pagination-0.2.zip", "has_sig": false, "md5_digest": "7b9b58c7252f76684ecd6b47343c9805", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13925, "upload_time": "2012-06-24T03:08:29", "url": "https://files.pythonhosted.org/packages/3d/fa/f692f57f07c60f72cbece99121fbd3073c0ccb396b6858d4e70728d85cc0/django-pure-pagination-0.2.zip" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "143613cf47d58e8d344d638e0efeaffc", "sha256": "c2f5005e7c53e31b7fcad80d18dc8a4c6f1f59cc1ec45c4d5029dd7ff9a37c9a" }, "downloads": -1, "filename": "django-pure-pagination-0.2.1.zip", "has_sig": false, "md5_digest": "143613cf47d58e8d344d638e0efeaffc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16552, "upload_time": "2012-06-24T03:12:53", "url": "https://files.pythonhosted.org/packages/98/7b/f5e5d3782555d1ff567d913c4257314a0c7d8cd851f12612dfe054a9155d/django-pure-pagination-0.2.1.zip" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "df040d86369f3f0dd5156ca9fe3cc46b", "sha256": "02b42561b8afb09f1fb6ac6dc81db13374f5f748640f31c8160a374274b54713" }, "downloads": -1, "filename": "django-pure-pagination-0.3.0.tar.gz", "has_sig": false, "md5_digest": "df040d86369f3f0dd5156ca9fe3cc46b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10857, "upload_time": "2015-12-26T22:50:50", "url": "https://files.pythonhosted.org/packages/55/43/50c475f408d3350cec340855970a5ce02ea12f5a53d520315f200b4847a1/django-pure-pagination-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "df040d86369f3f0dd5156ca9fe3cc46b", "sha256": "02b42561b8afb09f1fb6ac6dc81db13374f5f748640f31c8160a374274b54713" }, "downloads": -1, "filename": "django-pure-pagination-0.3.0.tar.gz", "has_sig": false, "md5_digest": "df040d86369f3f0dd5156ca9fe3cc46b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10857, "upload_time": "2015-12-26T22:50:50", "url": "https://files.pythonhosted.org/packages/55/43/50c475f408d3350cec340855970a5ce02ea12f5a53d520315f200b4847a1/django-pure-pagination-0.3.0.tar.gz" } ] }