From 1ef440fb8f0af43d16a3a120aaa7e5675fc93067 Mon Sep 17 00:00:00 2001 From: eneller Date: Sat, 5 Apr 2025 10:28:08 +0200 Subject: [PATCH] feat: display number of search results --- src/core/views.py | 4 +++- src/epub2go_web/templates/home.html | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/views.py b/src/core/views.py index b23cd19..8fdf636 100644 --- a/src/core/views.py +++ b/src/core/views.py @@ -35,11 +35,13 @@ def index(request: HttpRequest): localbooks = [book for book in books if searchParam in book.title] # return base view + # TODO pagination context = { 'title': 'epub2go', 'http_host': f'http://{ request.META['HTTP_HOST'] }', 'books': localbooks, - 'book_count': len(books), + 'books_count': len(localbooks), + 'allbooks_count': len(books), 'allbooks_url': allbooks_url, } return render(request, 'home.html', context) diff --git a/src/epub2go_web/templates/home.html b/src/epub2go_web/templates/home.html index 9bd682f..021e235 100644 --- a/src/epub2go_web/templates/home.html +++ b/src/epub2go_web/templates/home.html @@ -8,7 +8,7 @@ - Im Moment finden sich hier {{ book_count }} Bücher. + Im Moment finden sich hier {{ allbooks_count }} Bücher. Bookmarklet @@ -45,5 +45,6 @@ {% endfor %} + {{ books_count }} Ergebnisse gefunden {% endblock %} \ No newline at end of file