I am trying to accept the user input using get method from an input field in a form, but it returns none and redirects to with the wrong parameter in the url. Can someone help me fix this
@app.route("/search")
def search():
search_query = request.args.get("q")
# search_results = api.search(search_query)
# return render_template("search.html", query=search_query, response=search_results)
return f'{search_query}'
# for testing and rewriting index folder:
@app.route("/index")
def index():
if request.method == "GET":
query = request.form.get("search_field")
redirect(url_for("search", q=query))
return render_template("index.html")```