Use elided page range on user admin view

This commit is contained in:
Mouse Reeve 2022-11-01 18:45:03 -07:00
parent 43202f5bb7
commit 61c2d2a36a

View file

@ -10,7 +10,7 @@ from bookwyrm import forms, models
from bookwyrm.settings import PAGE_LENGTH
# pylint: disable= no-self-use
# pylint: disable=no-self-use
@method_decorator(login_required, name="dispatch")
@method_decorator(
permission_required("bookwyrm.moderate_user", raise_exception=True),
@ -55,8 +55,12 @@ class UserAdminList(View):
users = users.order_by(sort)
paginated = Paginator(users, PAGE_LENGTH)
page = paginated.get_page(request.GET.get("page"))
data = {
"users": paginated.get_page(request.GET.get("page")),
"users": page,
"page_range": paginated.get_elided_page_range(
page.number, on_each_side=2, on_ends=1
),
"sort": sort,
"server": server,
"status": status,