Add a basic search input to search page
This commit is contained in:
parent
2ae2a2c158
commit
5da96236be
2 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,7 @@ class SearchPage(BaseContentMixin, BasePage): # type: ignore[misc]
|
||||||
|
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
search_query = serializer.validated_data["q"]
|
search_query = serializer.validated_data["q"]
|
||||||
|
context["search_query"] = search_query
|
||||||
filters, query = parse_query_string(search_query)
|
filters, query = parse_query_string(search_query)
|
||||||
Query.get(search_query).add_hit()
|
Query.get(search_query).add_hit()
|
||||||
pages = self.get_search_pages().search(query)
|
pages = self.get_search_pages().search(query)
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
</section>
|
</section>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<section class="container">
|
||||||
|
<form>
|
||||||
|
<input type="search" name="q" placeholder="Search" value="{{ search_query }}"/>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="container">
|
<section class="container">
|
||||||
{% if initial %}
|
{% if initial %}
|
||||||
<p>Enter search terms</p>
|
<p>Enter search terms</p>
|
||||||
|
|
Loading…
Reference in a new issue