Add a basic search input to search page

This commit is contained in:
Jake Howard 2022-07-29 22:49:08 +01:00
parent 2ae2a2c158
commit 5da96236be
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 7 additions and 0 deletions

View file

@ -45,6 +45,7 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc]
if serializer.is_valid():
search_query = serializer.validated_data["q"]
context["search_query"] = search_query
filters, query = parse_query_string(search_query)
Query.get(search_query).add_hit()
pages = self.get_search_pages().search(query)

View file

@ -10,6 +10,12 @@
</section>
{% endif %}
<section class="container">
<form>
<input type="search" name="q" placeholder="Search" value="{{ search_query }}"/>
</form>
</section>
<section class="container">
{% if initial %}
<p>Enter search terms</p>