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 new file mode 100755 index 0000000..fc00090 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +django-pagination +================= + +A set of utilities for creating robust pagination tools throughout a django application. + +Fork from: https://github.com/ericflo/django-pagination 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 f8a2a6f..15fbb67 --- a/pagination/middleware.py +++ b/pagination/middleware.py @@ -1,17 +1,19 @@ +from django.utils.deprecation import MiddlewareMixin + def get_page(self): """ A function which will be monkeypatched onto the request to get the current integer representing the current page. """ try: - return int(self.REQUEST['page']) + return int(self.GET.get('page')) 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. """ def process_request(self, request): - request.__class__.page = property(get_page) \ No newline at end of file + request.__class__.page = property(get_page) 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 index ae843b1..abf85ec --- a/pagination/templatetags/pagination_tags.py +++ b/pagination/templatetags/pagination_tags.py @@ -133,7 +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) # 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 @@ -222,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)( 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