X-Git-Url: https://git.mdrn.pl/django-pagination.git/blobdiff_plain/abf535d21fd19b257e5d6fecfd60e470cc12de7f..0a28b77641bb5ad58bf832e55db65204e3f6e41d:/fnp_django_pagination/middleware.py diff --git a/fnp_django_pagination/middleware.py b/fnp_django_pagination/middleware.py index 580be43..4036511 100644 --- a/fnp_django_pagination/middleware.py +++ b/fnp_django_pagination/middleware.py @@ -28,8 +28,14 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +try: + from django.utils.deprecation import MiddlewareMixin +except ImportError: + # Django < 1.10 + MiddlewareMixin = object -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. @@ -45,7 +51,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.