diff options
| author | Nick Pope <nick.pope@flightdataservices.com> | 2020-07-30 23:22:34 +0100 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2020-08-06 12:38:56 +0200 |
| commit | f35840c19664fed7b6bc4cf561bf0b6fd1a3b463 (patch) | |
| tree | 35cfb5f2ea7060d91e273ca51d6adbd6065fe1b5 /django | |
| parent | b203ec70fd7ffc4027380940157d1cf9c9e588ad (diff) | |
Refs #25513 -- Fixed admin pagination elision bounds.
It doesn't make sense to elide a single page number which could be a
clickable link to that page. We only want to elide two or more pages.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 088b85991f..5c8d21d30d 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -67,14 +67,14 @@ def pagination(cl): # links at either end of the list of pages, and there are always # ON_EACH_SIDE links at either end of the "current page" link. page_range = [] - if page_num > (1 + ON_EACH_SIDE + ON_ENDS): + if page_num > (1 + ON_EACH_SIDE + ON_ENDS) + 1: page_range += [ *range(1, ON_ENDS + 1), DOT, *range(page_num - ON_EACH_SIDE, page_num + 1), ] else: page_range.extend(range(1, page_num + 1)) - if page_num < (paginator.num_pages - ON_EACH_SIDE - ON_ENDS): + if page_num < (paginator.num_pages - ON_EACH_SIDE - ON_ENDS) - 1: page_range += [ *range(page_num + 1, page_num + ON_EACH_SIDE + 1), DOT, *range(paginator.num_pages - ON_ENDS + 1, paginator.num_pages + 1) |
