From: Zygmunt Krynicki Date: Tue, 29 Dec 2015 10:05:55 +0000 (+0100) Subject: Merge pull request #28 from amrael/django18_2 X-Git-Tag: 2.2.0~3 X-Git-Url: https://git.mdrn.pl/django-pagination.git/commitdiff_plain/cc09a6ef903c38873717ae435843adfce4dba6e6?hp=986c8f62e9caf19bd007e4e6ce167a1dde749e89 Merge pull request #28 from amrael/django18_2 Suppress RemovedInDjango19Warning --- diff --git a/linaro_django_pagination/middleware.py b/linaro_django_pagination/middleware.py index 73d2713..580be43 100644 --- a/linaro_django_pagination/middleware.py +++ b/linaro_django_pagination/middleware.py @@ -35,7 +35,12 @@ def get_page(self, suffix): integer representing the current page. """ try: - return int(self.REQUEST['page%s' % suffix]) + # REQUEST is deprecated as of Django 1.7. + key = 'page%s' % suffix + value = self.POST.get(key) + if value is None: + value = self.GET.get(key) + return int(value) except (KeyError, ValueError, TypeError): return 1