From bd3acdbf31887801138324574726cff2e6c21a6f Mon Sep 17 00:00:00 2001 From: Ross Chapman Date: Thu, 14 Dec 2023 12:33:27 -0800 Subject: [PATCH] Puts string in template --- bookwyrm/templates/shelf/shelf.html | 4 ++-- bookwyrm/views/shelf/shelf.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bookwyrm/templates/shelf/shelf.html b/bookwyrm/templates/shelf/shelf.html index 60b822322..d224b0a4f 100644 --- a/bookwyrm/templates/shelf/shelf.html +++ b/bookwyrm/templates/shelf/shelf.html @@ -106,8 +106,8 @@ (showing {{ start }}-{{ end }}) {% endblocktrans %} {% endif %} - {% if shelves_filter_msg %} - - {{ shelves_filter_msg }} "{{ shelves_filter_query }}" + {% if show_shelves_filter_msg %} + - {% trans "We couldn't find any books that matched" %} "{{ shelves_filter_query }}" {% endif %} {% endif %} diff --git a/bookwyrm/views/shelf/shelf.py b/bookwyrm/views/shelf/shelf.py index 2b9ab176a..eae57b409 100644 --- a/bookwyrm/views/shelf/shelf.py +++ b/bookwyrm/views/shelf/shelf.py @@ -35,7 +35,7 @@ class Shelf(View): shelves = models.Shelf.privacy_filter(request.user).filter(user=user).all() shelves_filter_query = request.GET.get("filter") - shelves_filter_msg = "" + show_shelves_filter_msg = False # get the shelf and make sure the logged in user should be able to see it if shelf_identifier: @@ -95,7 +95,7 @@ class Shelf(View): if shelves_filter_query: books = search(shelves_filter_query, books=books) or books - shelves_filter_msg = "We couldn't find any books that matched" + show_shelves_filter_msg = True paginated = Paginator( books, @@ -115,7 +115,7 @@ class Shelf(View): page.number, on_each_side=2, on_ends=1 ), "shelves_filter_query": shelves_filter_query, - "shelves_filter_msg": shelves_filter_msg, + "show_shelves_filter_msg": show_shelves_filter_msg, } return TemplateResponse(request, "shelf/shelf.html", data)