django-pagination-py3


Namedjango-pagination-py3 JSON
Version 2.0.0 PyPI version JSON
download
home_page
SummaryA port of ericflo/django-pagination to Python 3 and beyond!
upload_time2024-02-14 03:23:35
maintainer
docs_urlNone
author
requires_python
license
keywords django pagination
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            django-pagination-py3
====================

![Python Compatibility](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg) [![PyPi Version](https://img.shields.io/pypi/v/django-pagination-py3.svg)](https://pypi.python.org/pypi/django-pagination-py3)  ![CI badge](https://github.com/matagus/django-pagination-py3/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/matagus/django-pagination-py3/graph/badge.svg?token=a64SxEDQk0)](https://codecov.io/gh/matagus/django-pagination-py3) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

A port of [ericflo/django-pagination](https://github.com/ericflo/django-pagination) to Python 3. Updated to be compatible with Django 4.x and 5.0.

For versions compatible with Django 3.x and Python 2.7+ please install or download version `1.2.0` from [Releases](https://github.com/matagus/django-pagination-py3/releases) or
[Pypi](https://pypi.org/project/django-pagination-py3/).

Features
========

- Really easy to use at template level.
- It preserves all request's querystring parameters.
- Settings to customize behavior.
- Translated to fr, de, es, pt, pl and pt_BR.
- A fully working example project.


Installation
============

Install using `pip` command:

```bash
pip install django-pagination-py3
```

...or clone the repo and install it using `pip`:

```bash
git clone git://github.com/matagus/django-pagination-py3.git
cd django-pagination-py3
pip install -e .
```

Add `pagination` INSTALLED_APPS to your `settings.py`:

```python
INSTALLED_APPS = (
    # ...
    "pagination",
)
```

Add the middleware:

```python
   MIDDLEWARE_CLASSES = (
       # ...
       'pagination.middleware.PaginationMiddleware',
   )
```

Add this line at the top of your template to load the pagination tags:

```html
  {% load pagination_tags %}
```

Decide on a variable that you would like to paginate, and use the autopaginate tag on that variable before iterating
over it. This could take one of two forms (using the canonical `object_list` as an example variable):

```html
  {% autopaginate object_list %}
```

This assumes that you would like to have the default 20 results per page. If you would like to specify your own amount
of results per page, you can specify that like so:

```html
  {% autopaginate object_list 10 %}
```

Note that this replaces ``object_list`` with the list for the current page, so you can iterate over the `object_list`
like you normally would.


Now you want to display the current page and the available pages, so somewhere after having used autopaginate, use the
paginate inclusion tag:

```html
  {% paginate %}
```

This does not take any arguments, but does assume that you have already called autopaginate, so make sure to do so first.


That's it! You have now paginated `object_list` and given users of the site a way to navigate between the different
pages--all without touching your views.


Running Tests
-------------

`hatch run test:test` will run the tests in every Python + Django versions combination.

`hatch run test.py3.12-5.0:test`: will run them for python 3.12 and Django 5.0. Please see possible combinations using
`hatch env show` ("test" matrix).


License
=======

`django-pagination-py3` is released under an BSD License - see the `LICENSE` file for more information.


Acknowledgements
================

Develop & built using [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Posts I learned from:

- [Switching to Hatch](https://andrich.me/2023/08/switching-to-hatch/)
- [Automate Hatch Publish with GitHub Actions](https://blog.pecar.me/automate-hatch-publish)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-pagination-py3",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,pagination",
    "author": "",
    "author_email": "Agustin Mendez <matagus@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a1/52/111041f9750137812f9cf79777bd8401ec5935dd8d50a79d74b97f775de4/django_pagination_py3-2.0.0.tar.gz",
    "platform": null,
    "description": "django-pagination-py3\n====================\n\n![Python Compatibility](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue.svg) [![PyPi Version](https://img.shields.io/pypi/v/django-pagination-py3.svg)](https://pypi.python.org/pypi/django-pagination-py3)  ![CI badge](https://github.com/matagus/django-pagination-py3/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/matagus/django-pagination-py3/graph/badge.svg?token=a64SxEDQk0)](https://codecov.io/gh/matagus/django-pagination-py3) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nA port of [ericflo/django-pagination](https://github.com/ericflo/django-pagination) to Python 3. Updated to be compatible with Django 4.x and 5.0.\n\nFor versions compatible with Django 3.x and Python 2.7+ please install or download version `1.2.0` from [Releases](https://github.com/matagus/django-pagination-py3/releases) or\n[Pypi](https://pypi.org/project/django-pagination-py3/).\n\nFeatures\n========\n\n- Really easy to use at template level.\n- It preserves all request's querystring parameters.\n- Settings to customize behavior.\n- Translated to fr, de, es, pt, pl and pt_BR.\n- A fully working example project.\n\n\nInstallation\n============\n\nInstall using `pip` command:\n\n```bash\npip install django-pagination-py3\n```\n\n...or clone the repo and install it using `pip`:\n\n```bash\ngit clone git://github.com/matagus/django-pagination-py3.git\ncd django-pagination-py3\npip install -e .\n```\n\nAdd `pagination` INSTALLED_APPS to your `settings.py`:\n\n```python\nINSTALLED_APPS = (\n    # ...\n    \"pagination\",\n)\n```\n\nAdd the middleware:\n\n```python\n   MIDDLEWARE_CLASSES = (\n       # ...\n       'pagination.middleware.PaginationMiddleware',\n   )\n```\n\nAdd this line at the top of your template to load the pagination tags:\n\n```html\n  {% load pagination_tags %}\n```\n\nDecide on a variable that you would like to paginate, and use the autopaginate tag on that variable before iterating\nover it. This could take one of two forms (using the canonical `object_list` as an example variable):\n\n```html\n  {% autopaginate object_list %}\n```\n\nThis assumes that you would like to have the default 20 results per page. If you would like to specify your own amount\nof results per page, you can specify that like so:\n\n```html\n  {% autopaginate object_list 10 %}\n```\n\nNote that this replaces ``object_list`` with the list for the current page, so you can iterate over the `object_list`\nlike you normally would.\n\n\nNow you want to display the current page and the available pages, so somewhere after having used autopaginate, use the\npaginate inclusion tag:\n\n```html\n  {% paginate %}\n```\n\nThis does not take any arguments, but does assume that you have already called autopaginate, so make sure to do so first.\n\n\nThat's it! You have now paginated `object_list` and given users of the site a way to navigate between the different\npages--all without touching your views.\n\n\nRunning Tests\n-------------\n\n`hatch run test:test` will run the tests in every Python + Django versions combination.\n\n`hatch run test.py3.12-5.0:test`: will run them for python 3.12 and Django 5.0. Please see possible combinations using\n`hatch env show` (\"test\" matrix).\n\n\nLicense\n=======\n\n`django-pagination-py3` is released under an BSD License - see the `LICENSE` file for more information.\n\n\nAcknowledgements\n================\n\nDevelop & built using [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![code style - black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nPosts I learned from:\n\n- [Switching to Hatch](https://andrich.me/2023/08/switching-to-hatch/)\n- [Automate Hatch Publish with GitHub Actions](https://blog.pecar.me/automate-hatch-publish)\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A port of ericflo/django-pagination to Python 3 and beyond!",
    "version": "2.0.0",
    "project_urls": {
        "Changelog": "https://github.com/matagus/django-pagination-py3/releases",
        "Homepage": "https://github.com/matagus/django-pagination-py3",
        "Issues": "https://github.com/matagus/django-pagination-py3/issues",
        "PyPI": "https://pypi.org/project/django-pagination-py3",
        "Repository": "https://github.com/matagus/django-pagination-py3"
    },
    "split_keywords": [
        "django",
        "pagination"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2a000cecf78d4b1a57aabc061edb3acb870ea825040a7c03266ff6e42a0572e",
                "md5": "cd1e685415cea5d16611464870e70ce8",
                "sha256": "1a9fb0b411b049b845e86c52cd0185f9156f851c6dc9cce3125a1cc26f9d23f3"
            },
            "downloads": -1,
            "filename": "django_pagination_py3-2.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd1e685415cea5d16611464870e70ce8",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 18660,
            "upload_time": "2024-02-14T03:23:33",
            "upload_time_iso_8601": "2024-02-14T03:23:33.947773Z",
            "url": "https://files.pythonhosted.org/packages/e2/a0/00cecf78d4b1a57aabc061edb3acb870ea825040a7c03266ff6e42a0572e/django_pagination_py3-2.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a152111041f9750137812f9cf79777bd8401ec5935dd8d50a79d74b97f775de4",
                "md5": "569f0d9e8b1841625ccb7f0d42234f69",
                "sha256": "ad4057cab3b7feb68d24d259677f4c8a53265981afcfaf7416d791a79d5d0d4f"
            },
            "downloads": -1,
            "filename": "django_pagination_py3-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "569f0d9e8b1841625ccb7f0d42234f69",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10396,
            "upload_time": "2024-02-14T03:23:35",
            "upload_time_iso_8601": "2024-02-14T03:23:35.240076Z",
            "url": "https://files.pythonhosted.org/packages/a1/52/111041f9750137812f9cf79777bd8401ec5935dd8d50a79d74b97f775de4/django_pagination_py3-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-14 03:23:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matagus",
    "github_project": "django-pagination-py3",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "django-pagination-py3"
}
        
Elapsed time: 0.20461s