Show message when there's no search terms
This commit is contained in:
parent
71a2186cc0
commit
2ae2a2c158
2 changed files with 7 additions and 2 deletions
|
@ -70,6 +70,9 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
|||
|
||||
context["results"] = results
|
||||
else:
|
||||
if "q" in request.GET:
|
||||
context["invalid_search"] = True
|
||||
else:
|
||||
context["initial"] = True
|
||||
|
||||
return context
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
{% endif %}
|
||||
|
||||
<section class="container">
|
||||
{% if invalid_search %}
|
||||
{% if initial %}
|
||||
<p>Enter search terms</p>
|
||||
{% elif invalid_search %}
|
||||
<p>Invalid search</p>
|
||||
{% elif results|length == 0 %}
|
||||
{% if page_num > paginator.num_pages %}
|
||||
|
|
Loading…
Reference in a new issue