Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 1.9 Compatibility #49

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified CONTRIBUTORS.txt
100644 → 100755
Empty file.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
Empty file modified MANIFEST.in
100644 → 100755
Empty file.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Empty file modified docs/index.txt
100644 → 100755
Empty file.
Empty file modified docs/install.txt
100644 → 100755
Empty file.
Empty file modified docs/usage.txt
100644 → 100755
Empty file.
Empty file modified pagination/__init__.py
100644 → 100755
Empty file.
Empty file modified pagination/locale/de/LC_MESSAGES/django.mo
100644 → 100755
Empty file.
Empty file modified pagination/locale/de/LC_MESSAGES/django.po
100644 → 100755
Empty file.
Empty file modified pagination/locale/fr/LC_MESSAGES/django.mo
100644 → 100755
Empty file.
Empty file modified pagination/locale/fr/LC_MESSAGES/django.po
100644 → 100755
Empty file.
Empty file modified pagination/locale/pl/LC_MESSAGES/django.mo
100644 → 100755
Empty file.
Empty file modified pagination/locale/pl/LC_MESSAGES/django.po
100644 → 100755
Empty file.
Empty file modified pagination/locale/pt/LC_MESSAGES/django.mo
100644 → 100755
Empty file.
Empty file modified pagination/locale/pt/LC_MESSAGES/django.po
100644 → 100755
Empty file.
8 changes: 5 additions & 3 deletions pagination/middleware.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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)
request.__class__.page = property(get_page)
Empty file modified pagination/models.py
100644 → 100755
Empty file.
Empty file modified pagination/paginator.py
100644 → 100755
Empty file.
Empty file modified pagination/templates/pagination/pagination.html
100644 → 100755
Empty file.
Empty file modified pagination/templatetags/__init__.py
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions pagination/templatetags/pagination_tags.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)(
Expand Down
Empty file modified pagination/tests.py
100644 → 100755
Empty file.
Empty file modified setup.py
100644 → 100755
Empty file.
Empty file modified tests/runtests.py
100644 → 100755
Empty file.
Empty file modified tests/settings.py
100644 → 100755
Empty file.