Puts string in template

This commit is contained in:
Ross Chapman 2023-12-14 12:33:27 -08:00
parent 4a4046a704
commit bd3acdbf31
2 changed files with 5 additions and 5 deletions

View file

@ -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 %}
</span>
{% endif %}

View file

@ -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)