{ "info": { "author": "Danilo Bargen", "author_email": "gezuru@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-simplepaginator\n======================\n\ndjango-simplepaginator is a small wrapper around the standard Django paginator. The goal of\ndjango-simplepaginator is _not_ to replace the Django paginator with yet another kind of pagination\ninterface. It just simplifies the creation of a pagination and provides templates for column\ntitles and page navigation. It supports sorting and orphans.\n\nInstallation\n------------\n\nCopy the simple_paginator folder to your project or install it into your pythonpath:\n\n # python setup.py install\n\nIf you use pip, you can also install it directly using the -e parameter:\n\n # pip install -e git://github.com/dbrgn/django-simplepaginator.git#egg=simple_paginator\n\nThen add simple_paginator to your `INSTALLED_APPS` setting.\n\nUsage\n-----\n\nThe SimplePaginator object accepts the following keyword arguments:\n\n* `request` -- The request object\n* `prefix` -- The prefix for the controls' css-class and for the GET parameters\n* `data` -- Elements to paginate\n* `columns` -- A tuple of tuples containing column name and key (default None)\n* `per_page` -- How many elements to display per page (default 20)\n* `orphans` -- Whether to move orphans to the previous page (default 1)\n\nIn the view, use the `paginate()`-shortcutfunction to return pagination items. Remember that each\npagination on a page must have a distinct prefix.\n\nColumns can be marked as non-sortable by setting the sort key to `None`.\n\n### Example:\n\n```python\nfrom django.shortcuts import render_to_response\nimport simple_paginator\n\ntry:\n objects = models.Example.objects.filter(id__lte=100)\nexcept ObjectDoesNotExist:\n objects = None\n\nprefix = 'itemlist'\ncolumns = (\n ('Column1', 'modelfield1'),\n ('Column2', 'modelfield2'),\n ('Column3', None),\n)\nitems, order, baseurl = simple_paginator.paginate(request, prefix, functions, columns)\n\ncontext = {\n 'items': items,\n 'prefix': prefix,\n 'columns': columns,\n 'order': order,\n 'baseurl': baseurl\n}\nreturn render_to_response('template.html', context)\n```\n\nAnd in the template:\n\n```html\n
This pagination shows all Example objects with an id <= 100.
\n\n| {{ item.modelfield1 }} | \n{{ item.modelfield2 }} | \n{{ item.modelfield3 }} | \n
This pagination lists some items.
\n\n