Skip to content

Commit

Permalink
Merge pull request #106 from nationalarchives/fix/add-pagination-to-h…
Browse files Browse the repository at this point in the history
…omepage

Add pagination to Editor homepage
  • Loading branch information
LewisDaleUK authored Apr 26, 2022
2 parents e985ed5 + b539863 commit ed26302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h2 id="recently-published-judgments" class="recent-judgments__header">{% transl
</li>
{% endfor %}
</ul>
{% include 'includes/pagination.html' %}
<p class="recent-judgments__more-info"><a href="{% url 'results' %}">{% translate "judgments.allrecent" %}</a></p>
</div>
</div>
5 changes: 4 additions & 1 deletion judgments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ed26302

Please sign in to comment.