From b539863a21d9c6e0deb855a6a6ff95d1e4130821 Mon Sep 17 00:00:00 2001 From: Laura Porter Date: Mon, 25 Apr 2022 16:21:18 +0100 Subject: [PATCH] Add pagination to Editor homepage This is a quick fix. Currently we only show max 10 unpublished judgments on the editor homepage. As more judgments come in the editors are struggling to see judgments awaiting editing. As a quick fix for now, add pagination to the homepage to allow editors to paginate through unpublished judgments. --- .../templates/includes/recent_judgments.html | 1 + judgments/views.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ds_caselaw_editor_ui/templates/includes/recent_judgments.html b/ds_caselaw_editor_ui/templates/includes/recent_judgments.html index 04952b3ed..9be32e1f1 100644 --- a/ds_caselaw_editor_ui/templates/includes/recent_judgments.html +++ b/ds_caselaw_editor_ui/templates/includes/recent_judgments.html @@ -39,6 +39,7 @@

{% transl {% endfor %} + {% include 'includes/pagination.html' %}

{% translate "judgments.allrecent" %}

diff --git a/judgments/views.py b/judgments/views.py index 8b1283fb2..e9c50b618 100644 --- a/judgments/views.py +++ b/judgments/views.py @@ -159,11 +159,14 @@ def update(request): def index(request): context = {} try: - model = perform_advanced_search(order="-date", only_unpublished=True) + params = request.GET + page = params.get("page") if params.get("page") else "1" + model = perform_advanced_search(order="-date", only_unpublished=True, page=page) search_results = [ SearchResult.create_from_node(result) for result in model.results ] context["recent_judgments"] = search_results + context["paginator"] = paginator(int(page), model.total) except MarklogicResourceNotFoundError: raise Http404(