From 60702e3939ff91e687e848117f0f77ccd4fcb340 Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Mon, 24 Aug 2020 15:25:07 -0700 Subject: [PATCH] Added django_tables2.0.0 with pagination. --- agagd/agagd_core/views/core.py | 6 +++++- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/agagd/agagd_core/views/core.py b/agagd/agagd_core/views/core.py index 6e1663d1..d79a2bb8 100644 --- a/agagd/agagd_core/views/core.py +++ b/agagd/agagd_core/views/core.py @@ -5,6 +5,7 @@ from agagd_core.ratings_top_ten_requests import RatingsTopRequest from datetime import datetime, timedelta, date from django.core import exceptions +from django.core.paginator import PageNotAnInteger from django.core.urlresolvers import reverse from django.db.models import F, Q, Count from django.http import HttpResponseRedirect @@ -69,7 +70,10 @@ def search(request): member_table = MemberTable(members_query) - RequestConfig(request, paginate={'per_page': 100}).configure(member_table) + try: + RequestConfig(request, paginate={'per_page': 100}).configure(member_table) + except PageNotAnInteger: + RequestConfig(request, paginate=False).configure(member_table) return render(request, 'agagd_core/search_player.html', { diff --git a/requirements.txt b/requirements.txt index 4831670b..57633431 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ Django==1.11.29 django-admin-tools==0.4.1 -django-tables2==1.15.0 +django-tables2==2.0.0 PyMySQL==0.10.0 requests==2.22.0 six==1.4.1