From d565d53237223f64db7d04cd2eef1359d54d903c Mon Sep 17 00:00:00 2001 From: Alonso Date: Thu, 21 Feb 2013 14:20:54 -0500 Subject: [PATCH 1/8] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..96d9608 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +django-pagination +================= + +A set of utilities for creating robust pagination tools throughout a django application. From f5bce8193285c30d220d917ad8f06e155a80e65f Mon Sep 17 00:00:00 2001 From: Alonso Date: Thu, 21 Feb 2013 14:21:32 -0500 Subject: [PATCH 2/8] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 96d9608..796c9e6 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,5 @@ django-pagination ================= A set of utilities for creating robust pagination tools throughout a django application. + +Fork: https://github.com/ericflo/django-pagination From ffe6cf68b95cee5abc181b40871bd2c403bbef06 Mon Sep 17 00:00:00 2001 From: Alonso Date: Mon, 14 Dec 2015 17:19:42 -0500 Subject: [PATCH 3/8] Changed self.REQUEST for self.GET.get --- pagination/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pagination/middleware.py b/pagination/middleware.py index f8a2a6f..1f0e3f2 100644 --- a/pagination/middleware.py +++ b/pagination/middleware.py @@ -4,7 +4,7 @@ def get_page(self): integer representing the current page. """ try: - return int(self.REQUEST['page']) + return int(self.GEt.get('page')) except (KeyError, ValueError, TypeError): return 1 @@ -14,4 +14,4 @@ class PaginationMiddleware(object): it exists in either **GET** or **POST** portions of the request. """ def process_request(self, request): - request.__class__.page = property(get_page) \ No newline at end of file + request.__class__.page = property(get_page) From 4a8f1091bec4830a8ebf1ba42be09a7950ce5121 Mon Sep 17 00:00:00 2001 From: Alonso Date: Mon, 14 Dec 2015 17:23:17 -0500 Subject: [PATCH 4/8] Changed GEt for GET --- pagination/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pagination/middleware.py b/pagination/middleware.py index 1f0e3f2..a229546 100644 --- a/pagination/middleware.py +++ b/pagination/middleware.py @@ -4,7 +4,7 @@ def get_page(self): integer representing the current page. """ try: - return int(self.GEt.get('page')) + return int(self.GET.get('page')) except (KeyError, ValueError, TypeError): return 1 From 4dc8fda7d209b165b092c64264d4378604070846 Mon Sep 17 00:00:00 2001 From: Alonso Date: Mon, 14 Dec 2015 17:56:05 -0500 Subject: [PATCH 5/8] Cast to list for prevent error --- pagination/templatetags/pagination_tags.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pagination/templatetags/pagination_tags.py b/pagination/templatetags/pagination_tags.py index ae843b1..8456f22 100644 --- a/pagination/templatetags/pagination_tags.py +++ b/pagination/templatetags/pagination_tags.py @@ -134,6 +134,7 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''): paginator = context['paginator'] page_obj = context['page_obj'] page_range = paginator.page_range + page_range = list(paginator.page_range) # Calculate the record range in the current page for display. records = {'first': 1 + (page_obj.number - 1) * paginator.per_page} records['last'] = records['first'] + paginator.per_page - 1 From f32d675bcc4c42408095c7fec36e84bc77c451a0 Mon Sep 17 00:00:00 2001 From: amarok Date: Tue, 23 Aug 2016 14:27:03 -0500 Subject: [PATCH 6/8] Fix space error and patch except sintaxis for Python 2.7 and 3.X --- pagination/templatetags/pagination_tags.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pagination/templatetags/pagination_tags.py b/pagination/templatetags/pagination_tags.py index 8456f22..abf85ec 100644 --- a/pagination/templatetags/pagination_tags.py +++ b/pagination/templatetags/pagination_tags.py @@ -133,8 +133,7 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''): try: paginator = context['paginator'] page_obj = context['page_obj'] - page_range = paginator.page_range - page_range = list(paginator.page_range) + page_range = list(paginator.page_range) # Calculate the record range in the current page for display. records = {'first': 1 + (page_obj.number - 1) * paginator.per_page} records['last'] = records['first'] + paginator.per_page - 1 @@ -223,7 +222,7 @@ def paginate(context, window=DEFAULT_WINDOW, hashtag=''): else: to_return['getvars'] = '' return to_return - except KeyError, AttributeError: + except (KeyError, AttributeError): return {} register.inclusion_tag('pagination/pagination.html', takes_context=True)( From daae83ac3acc289253616fcc258837bc1f9f73e6 Mon Sep 17 00:00:00 2001 From: Alonso Date: Fri, 18 May 2018 15:51:31 -0500 Subject: [PATCH 7/8] Fix old middleware implementation --- .gitignore | 0 CONTRIBUTORS.txt | 0 LICENSE.txt | 0 MANIFEST.in | 0 README.md | 0 docs/index.txt | 0 docs/install.txt | 0 docs/usage.txt | 0 pagination/__init__.py | 0 pagination/locale/de/LC_MESSAGES/django.mo | Bin pagination/locale/de/LC_MESSAGES/django.po | 0 pagination/locale/fr/LC_MESSAGES/django.mo | Bin pagination/locale/fr/LC_MESSAGES/django.po | 0 pagination/locale/pl/LC_MESSAGES/django.mo | Bin pagination/locale/pl/LC_MESSAGES/django.po | 0 pagination/locale/pt/LC_MESSAGES/django.mo | Bin pagination/locale/pt/LC_MESSAGES/django.po | 0 pagination/middleware.py | 4 +++- pagination/models.py | 0 pagination/paginator.py | 0 pagination/templates/pagination/pagination.html | 0 pagination/templatetags/__init__.py | 0 pagination/templatetags/pagination_tags.py | 0 pagination/tests.py | 0 setup.py | 0 tests/runtests.py | 0 tests/settings.py | 0 27 files changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 CONTRIBUTORS.txt mode change 100644 => 100755 LICENSE.txt mode change 100644 => 100755 MANIFEST.in mode change 100644 => 100755 README.md mode change 100644 => 100755 docs/index.txt mode change 100644 => 100755 docs/install.txt mode change 100644 => 100755 docs/usage.txt mode change 100644 => 100755 pagination/__init__.py mode change 100644 => 100755 pagination/locale/de/LC_MESSAGES/django.mo mode change 100644 => 100755 pagination/locale/de/LC_MESSAGES/django.po mode change 100644 => 100755 pagination/locale/fr/LC_MESSAGES/django.mo mode change 100644 => 100755 pagination/locale/fr/LC_MESSAGES/django.po mode change 100644 => 100755 pagination/locale/pl/LC_MESSAGES/django.mo mode change 100644 => 100755 pagination/locale/pl/LC_MESSAGES/django.po mode change 100644 => 100755 pagination/locale/pt/LC_MESSAGES/django.mo mode change 100644 => 100755 pagination/locale/pt/LC_MESSAGES/django.po mode change 100644 => 100755 pagination/middleware.py mode change 100644 => 100755 pagination/models.py mode change 100644 => 100755 pagination/paginator.py mode change 100644 => 100755 pagination/templates/pagination/pagination.html mode change 100644 => 100755 pagination/templatetags/__init__.py mode change 100644 => 100755 pagination/templatetags/pagination_tags.py mode change 100644 => 100755 pagination/tests.py mode change 100644 => 100755 setup.py mode change 100644 => 100755 tests/runtests.py mode change 100644 => 100755 tests/settings.py diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt old mode 100644 new mode 100755 diff --git a/LICENSE.txt b/LICENSE.txt old mode 100644 new mode 100755 diff --git a/MANIFEST.in b/MANIFEST.in old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/docs/index.txt b/docs/index.txt old mode 100644 new mode 100755 diff --git a/docs/install.txt b/docs/install.txt old mode 100644 new mode 100755 diff --git a/docs/usage.txt b/docs/usage.txt old mode 100644 new mode 100755 diff --git a/pagination/__init__.py b/pagination/__init__.py old mode 100644 new mode 100755 diff --git a/pagination/locale/de/LC_MESSAGES/django.mo b/pagination/locale/de/LC_MESSAGES/django.mo old mode 100644 new mode 100755 diff --git a/pagination/locale/de/LC_MESSAGES/django.po b/pagination/locale/de/LC_MESSAGES/django.po old mode 100644 new mode 100755 diff --git a/pagination/locale/fr/LC_MESSAGES/django.mo b/pagination/locale/fr/LC_MESSAGES/django.mo old mode 100644 new mode 100755 diff --git a/pagination/locale/fr/LC_MESSAGES/django.po b/pagination/locale/fr/LC_MESSAGES/django.po old mode 100644 new mode 100755 diff --git a/pagination/locale/pl/LC_MESSAGES/django.mo b/pagination/locale/pl/LC_MESSAGES/django.mo old mode 100644 new mode 100755 diff --git a/pagination/locale/pl/LC_MESSAGES/django.po b/pagination/locale/pl/LC_MESSAGES/django.po old mode 100644 new mode 100755 diff --git a/pagination/locale/pt/LC_MESSAGES/django.mo b/pagination/locale/pt/LC_MESSAGES/django.mo old mode 100644 new mode 100755 diff --git a/pagination/locale/pt/LC_MESSAGES/django.po b/pagination/locale/pt/LC_MESSAGES/django.po old mode 100644 new mode 100755 diff --git a/pagination/middleware.py b/pagination/middleware.py old mode 100644 new mode 100755 index a229546..15fbb67 --- a/pagination/middleware.py +++ b/pagination/middleware.py @@ -1,3 +1,5 @@ +from django.utils.deprecation import MiddlewareMixin + def get_page(self): """ A function which will be monkeypatched onto the request to get the current @@ -8,7 +10,7 @@ def get_page(self): except (KeyError, ValueError, TypeError): return 1 -class PaginationMiddleware(object): +class PaginationMiddleware(MiddlewareMixin): """ Inserts a variable representing the current page onto the request object if it exists in either **GET** or **POST** portions of the request. diff --git a/pagination/models.py b/pagination/models.py old mode 100644 new mode 100755 diff --git a/pagination/paginator.py b/pagination/paginator.py old mode 100644 new mode 100755 diff --git a/pagination/templates/pagination/pagination.html b/pagination/templates/pagination/pagination.html old mode 100644 new mode 100755 diff --git a/pagination/templatetags/__init__.py b/pagination/templatetags/__init__.py old mode 100644 new mode 100755 diff --git a/pagination/templatetags/pagination_tags.py b/pagination/templatetags/pagination_tags.py old mode 100644 new mode 100755 diff --git a/pagination/tests.py b/pagination/tests.py old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 diff --git a/tests/runtests.py b/tests/runtests.py old mode 100644 new mode 100755 diff --git a/tests/settings.py b/tests/settings.py old mode 100644 new mode 100755 From 3a7109841a83a858adde4cdf7a31d87c1150a318 Mon Sep 17 00:00:00 2001 From: Alonso Date: Thu, 9 Aug 2018 13:58:17 -0500 Subject: [PATCH 8/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 796c9e6..fc00090 100755 --- a/README.md +++ b/README.md @@ -3,4 +3,4 @@ django-pagination A set of utilities for creating robust pagination tools throughout a django application. -Fork: https://github.com/ericflo/django-pagination +Fork from: https://github.com/ericflo/django-pagination