keep keywords in search form.
modified: app.py modified: templates/base.html
This commit is contained in:
parent
5577821855
commit
926262cdaa
2 changed files with 11 additions and 3 deletions
12
app.py
12
app.py
|
|
@ -145,14 +145,22 @@ def search_page():
|
|||
username = request.args.get("username", "guest")
|
||||
if not keywords:
|
||||
return render_template(
|
||||
"search.html", results=[], username=username, error="Keywords are required"
|
||||
"search.html",
|
||||
keywords=keywords,
|
||||
results=[],
|
||||
username=username,
|
||||
error="Keywords are required",
|
||||
)
|
||||
|
||||
# Call the function to search messages
|
||||
search_results = search_messages(keywords)
|
||||
|
||||
return render_template(
|
||||
"search.html", results=search_results, username=username, error=None
|
||||
"search.html",
|
||||
keywords=keywords,
|
||||
results=search_results,
|
||||
username=username,
|
||||
error=None,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
<!-- Search form -->
|
||||
<div id="search-form" style="width: 90%;">
|
||||
<form action="/search" method="get">
|
||||
<input type="text" id="search-keywords" name="keywords" placeholder="Search for keywords..." style="width: 90%;">
|
||||
<input type="text" id="search-keywords" name="keywords" placeholder="Search for keywords..." style="width: 100%;" value="{{ keywords }}">
|
||||
<input type="hidden" id="username" name="username" value="{{ username }}">
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue