From 03a5ac9c3fead8688c43cd8d7c16d9870b9f85a4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 11 Sep 2021 14:27:42 -0700 Subject: [PATCH] Use elided page range for federated peer list --- bookwyrm/views/admin/federation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views/admin/federation.py b/bookwyrm/views/admin/federation.py index d4a1af12..7b9e550b 100644 --- a/bookwyrm/views/admin/federation.py +++ b/bookwyrm/views/admin/federation.py @@ -33,9 +33,13 @@ class Federation(View): servers = servers.order_by(sort) paginated = Paginator(servers, PAGE_LENGTH) + page = paginated.get_page(request.GET.get("page")) data = { - "servers": paginated.get_page(request.GET.get("page")), + "servers": page, + "page_range": paginated.get_elided_page_range( + page.number, on_each_side=2, on_ends=1 + ), "sort": sort, "form": forms.ServerForm(), }