From: test test Date: Tue, 1 Jun 2021 09:01:22 +0000 (+0200) Subject: Reinstall a pagination modules and add a patch to force postman to use it. X-Git-Tag: 2.8.1-ae~49 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=832d647380fab8b297752f5df893152092f03e2c;p=teleforma.git Reinstall a pagination modules and add a patch to force postman to use it. --- diff --git a/app/settings.py b/app/settings.py index 20ae3e24..7df12675 100644 --- a/app/settings.py +++ b/app/settings.py @@ -121,8 +121,7 @@ MIDDLEWARE = (('debug_toolbar.middleware.DebugToolbarMiddleware',) if DEBUG_TOOL 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', - # TODO : check if useless - # 'pagination.middleware.PaginationMiddleware', + 'dj_pagination.middleware.PaginationMiddleware', 'teleforma.middleware.XsSharing', 'django_user_agents.middleware.UserAgentMiddleware', ) @@ -142,7 +141,7 @@ INSTALLED_APPS = ( 'teleforma', 'sorl.thumbnail', # 'django_extensions', - # 'pagination', + 'dj_pagination', 'postman', # 'timezones', # 'googletools', diff --git a/requirements.txt b/requirements.txt index bec69740..b1365fd5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ Django==3.2.3 # django-extensions==1.2.1 # django-timezones==0.2 # django-registration==3.1.2 +dj_pagination==2.5.0 # used by postman django-json-rpc==0.7.1 # django-google-tools==1.1.0 django-nvd3==0.8.2 diff --git a/teleforma/__init__.py b/teleforma/__init__.py index e2b3b9d6..c9643f7c 100644 --- a/teleforma/__init__.py +++ b/teleforma/__init__.py @@ -47,3 +47,5 @@ same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. """ + +import teleforma.patches \ No newline at end of file diff --git a/teleforma/patches.py b/teleforma/patches.py new file mode 100644 index 00000000..5340983a --- /dev/null +++ b/teleforma/patches.py @@ -0,0 +1,5 @@ +# postman should use dj_pagination when installed but that's not the case here. +# Instead it uses its dj_pagination mock functions. +# So here we replace the pagination_tags templatetags of postman by those of dj_pagination. +import sys +sys.modules['postman.templatetags.pagination_tags'] = __import__('dj_pagination.templatetags.pagination_tags')