diff --git a/bookwyrm/templates/settings/reports/reports.html b/bookwyrm/templates/settings/reports/reports.html index 99cca1a7..64db2f26 100644 --- a/bookwyrm/templates/settings/reports/reports.html +++ b/bookwyrm/templates/settings/reports/reports.html @@ -44,5 +44,6 @@ {% endfor %} +{% include 'snippets/pagination.html' with page=reports path=request.path %} {% endblock %} diff --git a/bookwyrm/templates/settings/users/user_admin.html b/bookwyrm/templates/settings/users/user_admin.html index fdd9fb7d..4144f0bd 100644 --- a/bookwyrm/templates/settings/users/user_admin.html +++ b/bookwyrm/templates/settings/users/user_admin.html @@ -61,10 +61,25 @@ {% for user in users %}
{% blocktrans with date=user.created_date|naturaltime %}Joined {{ date }}{% endblocktrans %}
- {% if request.user.id == user.id %} + {% if request.user.id == user.id or admin_mode %} {% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}, {% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %} diff --git a/bookwyrm/views/admin/reports.py b/bookwyrm/views/admin/reports.py index bf9553e5..c19e3db4 100644 --- a/bookwyrm/views/admin/reports.py +++ b/bookwyrm/views/admin/reports.py @@ -1,5 +1,6 @@ """ moderation via flagged posts and users """ from django.contrib.auth.decorators import login_required, permission_required +from django.core.paginator import Paginator from django.core.exceptions import PermissionDenied from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse @@ -7,6 +8,7 @@ from django.utils.decorators import method_decorator from django.views import View from bookwyrm import forms, models +from bookwyrm.settings import PAGE_LENGTH # pylint: disable=no-self-use @@ -34,10 +36,17 @@ class ReportsAdmin(View): if username: filters["user__username__icontains"] = username filters["resolved"] = resolved + + reports = models.Report.objects.filter(**filters) + paginated = Paginator(reports, PAGE_LENGTH) + page = paginated.get_page(request.GET.get("page")) data = { "resolved": resolved, "server": server, - "reports": models.Report.objects.filter(**filters), + "reports": page, + "page_range": paginated.get_elided_page_range( + page.number, on_each_side=2, on_ends=1 + ), } return TemplateResponse(request, "settings/reports/reports.html", data)