From 944bc55ea0de7ce2be52608d0e071ceb02066791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20M=C3=A9ndez?= Date: Tue, 13 Feb 2024 19:34:06 -0600 Subject: [PATCH 1/3] Added Spanish + Czech and improved pt_BR translations --- pagination/locale/cs/LC_MESSAGES/django.mo | Bin 0 -> 441 bytes pagination/locale/cs/LC_MESSAGES/django.po | 27 ++++++++++++++++ pagination/locale/es/LC_MESSAGES/django.mo | Bin 0 -> 503 bytes pagination/locale/es/LC_MESSAGES/django.po | 27 ++++++++++++++++ pagination/locale/pt_BR/LC_MESSAGES/django.mo | Bin 0 -> 515 bytes pagination/locale/pt_BR/LC_MESSAGES/django.po | 29 ++++++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 pagination/locale/cs/LC_MESSAGES/django.mo create mode 100644 pagination/locale/cs/LC_MESSAGES/django.po create mode 100644 pagination/locale/es/LC_MESSAGES/django.mo create mode 100644 pagination/locale/es/LC_MESSAGES/django.po create mode 100644 pagination/locale/pt_BR/LC_MESSAGES/django.mo create mode 100644 pagination/locale/pt_BR/LC_MESSAGES/django.po diff --git a/pagination/locale/cs/LC_MESSAGES/django.mo b/pagination/locale/cs/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..4c4804d55431490ca708c6b18fc1ddfc6074cbf6 GIT binary patch literal 441 zcmYL_Pfx-y7{;e!H1p=!L+_-xp%R>En5^L9#>f~Xda`b1%*=M_ic!CZ2ag^+@+k~o z!_VS7V#1UD`o4$f{nP#));=`Q4sZmV0=s|*RC)kv00s7e8F03xX#(ON@D2F^#3e*H zYi+|_^;?UxSEUt_y<}ohY9lG0Sgf#{;3<=3Cb)%0cJJ065Huy>*bRny$O<79_RBO& z@bw}saU?9HkAevIB%=z7utOEIP}4BZv2lXU7BX8_vsE`t!vG@=VO-Vx-*-ps5c>gk zY;+S?zFWT!hD7&hscyJGOQtR-Q6INA lzG{~llbG;WBpFXF)PBsAt|c^Ief=!8V)e, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-03-16 16:26+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/pagination/pagination.html:5 +#: templates/pagination/pagination.html:7 +msgid "previous" +msgstr "předchozí" + +#: templates/pagination/pagination.html:21 +#: templates/pagination/pagination.html:23 +msgid "next" +msgstr "další" diff --git a/pagination/locale/es/LC_MESSAGES/django.mo b/pagination/locale/es/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..0a4bae836d3f42c8b6d95289b649d41e752ce623 GIT binary patch literal 503 zcmYL_$xg#C5J1BwL5`d`m>UR9ND4yWQbZ^zR3uGR0ur1stqDen9oY^7{)6A+#F=kk z5|BFbo5h;NCAUGhw0p08D_#NNJM3~^Xrul!~T@+3rN#Q&smnlt# zJNM}*a${yJWSU7+Fsn2riO6eSkWjPwMUmsO4L#O|Ud1*4IL%8Y3U8{)6D*f`&2kPI zXC)zRWKpDWctjs;kI{^ z4d8H|*SznEYl!4j&4kP;IeZk>9T&A`1q_rf4JEQ_L(}VY$)DTXl4P?-g6*#B7+gf) MQ0_2PS}5)O0t9J_h5!Hn literal 0 HcmV?d00001 diff --git a/pagination/locale/es/LC_MESSAGES/django.po b/pagination/locale/es/LC_MESSAGES/django.po new file mode 100644 index 0000000..6eb72fd --- /dev/null +++ b/pagination/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,27 @@ +# django-pagination Spanish translation +# Copyright (C) 2010, Miguel Araujo +# This file is distributed under the same license as the django-pagination package. +# Miguel Araujo , 2010 +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-16 16:32+0200\n" +"PO-Revision-Date: 2010-09-16 16:38+0200\n" +"Last-Translator: Miguel Araujo \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: templates/pagination/pagination.html:5 +#: templates/pagination/pagination.html:7 +msgid "previous" +msgstr "anterior" + +#: templates/pagination/pagination.html:21 +#: templates/pagination/pagination.html:23 +msgid "next" +msgstr "siguiente" diff --git a/pagination/locale/pt_BR/LC_MESSAGES/django.mo b/pagination/locale/pt_BR/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..7470b8ceb2a0603a5307364c194daa7d1b62f46d GIT binary patch literal 515 zcmZvZ&2H2%5XS=)3FXL{!*GMcEJ=W>@^(?%Wm{Fs!m6a48FpRQDDgyN2bJFX5IhNw zz*DLV=&_mm6e=2n*R@AG%v zkNzLJ>e$+CoyT}v3-&5yz1WYQhnTH|KiGA`(+$405j|EnvX+^}?{9Mt9tL4_rsSovgWgq1S^O$XRSGbq4CgS10F(CkxoG>x0%$ zSlnNYftB_%xWPsXM?%-W&6lUk#lKz8IV2mjrcb?gmh`2b^ey=?h4m##v}tzU9OGX8 zM>p1fVFedq%^M$_fxY)W<*RlOYVnw*iv~i!J;qrzg, 2011. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-01-16 22:06-0200\n" +"PO-Revision-Date: 2011-01-16 22:15-3\n" +"Last-Translator: Tiago Samaha Cordeiro \n" +"Language-Team: LANGUAGE \n" +"Language: Portuguese Brazil\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: templates/pagination/pagination.html:5 +#: templates/pagination/pagination.html:7 +msgid "previous" +msgstr "anterior" + +#: templates/pagination/pagination.html:21 +#: templates/pagination/pagination.html:23 +msgid "next" +msgstr "próximo" From d0fad098a7199cca7bcbd087d7c32c3700e0b6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20M=C3=A9ndez?= Date: Tue, 13 Feb 2024 21:10:42 -0600 Subject: [PATCH 2/3] Improved README.md including installation, usage + tests instructions, badges, etc --- README.md | 115 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 83035ff..0ab1677 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,117 @@ django-pagination-py3 -===================== +==================== -A port of django-pagination to Python 3, also compatible with Python 2.x ;) +![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). + -Install it from pypi.python.org: +License +======= - pip install django-pagination-py3 +`django-pagination-py3` is released under an BSD License - see the `LICENSE` file for more information. -or just clone this repository and run: - python setup.py install +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) -Usage ------ +Posts I learned from: -Use it the same way you use django-pagination. +- [Switching to Hatch](https://andrich.me/2023/08/switching-to-hatch/) +- [Automate Hatch Publish with GitHub Actions](https://blog.pecar.me/automate-hatch-publish) From 4caa6578ac223763fbc29f3d30c27d74b9ee04ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20M=C3=A9ndez?= Date: Tue, 13 Feb 2024 21:12:04 -0600 Subject: [PATCH 3/3] Bump version to 2.0.0 --- pagination/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pagination/__init__.py b/pagination/__init__.py index c203c5d..1b23640 100644 --- a/pagination/__init__.py +++ b/pagination/__init__.py @@ -1 +1 @@ -version = "1.2.0" +version = "2.0.0"