From 041368a65246f2a94cfc6a825ee1357f27c4481c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Valenta?= <git@imaniti.org> Date: Sat, 1 Jul 2023 15:52:58 +0900 Subject: [PATCH] add result count --- contracts/templates/contracts/search.html | 6 +++++- contracts/templatetags/add.py | 3 +++ contracts/views.py | 2 -- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contracts/templates/contracts/search.html b/contracts/templates/contracts/search.html index e17cc14..f1a7f5f 100644 --- a/contracts/templates/contracts/search.html +++ b/contracts/templates/contracts/search.html @@ -2,7 +2,11 @@ {% load add %} {% block content %} - {% include "contracts/includes/double_heading.html" with icon="ico--search" heading="Vyhledávání" %} + {% if any_query_is_set %} + {% include "contracts/includes/double_heading.html" with icon="ico--search" heading="Vyhledávání" subheading=page|length|add:" výsledků" %} + {% else %} + {% include "contracts/includes/double_heading.html" with icon="ico--search" heading="Vyhledávání" %} + {% endif %} <form method="get" class="mb-10"> <div class="flex flex-col gap-2"> diff --git a/contracts/templatetags/add.py b/contracts/templatetags/add.py index c8735e7..90a5c05 100644 --- a/contracts/templatetags/add.py +++ b/contracts/templatetags/add.py @@ -5,4 +5,7 @@ register = template.Library() @register.filter def add(value, arg): + if isinstance(arg, str): + value = str(value) + return value + arg diff --git a/contracts/views.py b/contracts/views.py index 5e59246..a3f23e9 100644 --- a/contracts/views.py +++ b/contracts/views.py @@ -243,8 +243,6 @@ def search(request): annotations, ) - print(filter) - return render( request, "contracts/search.html", -- GitLab