X-Git-Url: https://git.mdrn.pl/django-pagination.git/blobdiff_plain/abf535d21fd19b257e5d6fecfd60e470cc12de7f..4a48e40bd0a9a3bf0e8c8b7671e01508b2115bc0:/fnp_django_pagination/middleware.py diff --git a/fnp_django_pagination/middleware.py b/fnp_django_pagination/middleware.py index 580be43..9d2d9f4 100644 --- a/fnp_django_pagination/middleware.py +++ b/fnp_django_pagination/middleware.py @@ -28,14 +28,15 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from django.utils.deprecation import MiddlewareMixin -def get_page(self, suffix): + +def get_page(self, suffix=''): """ A function which will be monkeypatched onto the request to get the current integer representing the current page. """ try: - # REQUEST is deprecated as of Django 1.7. key = 'page%s' % suffix value = self.POST.get(key) if value is None: @@ -45,7 +46,7 @@ def get_page(self, suffix): 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.