I'm trying to make django-pagination
work with django-filter
since I'm working with very large tables. But, after implementing it, when I try to do python manage.py runserver
, I get a TypeError: TypeError: PaginationMiddleware() takes no arguments
This is what I have done so far:
- Installed django-pagination(1.0.7):
pip install django-pagination
- Added it in INSTALLED_APPS in settings.py:
INSTALLED_APPS= [....,'pagination',]
- In my TEMPLATES in settings.py:
'OPTIONS':{'context_processors': ['django.template.context_processors.request'],},
- In MIDDLEWARE in settings.py:
MIDDLEWARE = [...,'pagination.middleware.PaginationMiddleware',]
- In html file:
{% load pagination_tags %}
...
{% autopaginate filter.qs 40 as filter_list %}
{% for f in filter_list %}
...
{% endfor %}
{% paginate %}
I have all this, but when I try to do runserver
I get the following error:
File "D..Local\Programs\Python\Python38\lib\site-packages\django\core\handlers\base.py", line 36, in load_middleware
mw_instance = middleware(handler)
TypeError: PaginationMiddleware() takes no arguments
Am I missing something here? Any help is appreciated.
Django version: 2.1.13
Python version: 3.8
Edit: I was told in the comments that django_pagination
doesn't support the newer Django versions. I have tried dj_pagination
and django.core.paginator
as well. But I couldn't make django.core.paginator
work with django-filter