In flask, how do you implement a redirect while passing some sort of variable to add a message to the subsequent html?
This is an example from CS50's finance website's index page.
Notice how in the first html, there's no header tags, but when the user is in the '/buy' route and clicks 'buy', they get redirected back to the '/' route, this time with a header.
I'm assuming when the user clicks 'buy' the python looks something like:
@app.route('/buy', methods = ['GET', 'POST'])
def buy():
if request.method == 'POST':
# Code
return redirect('/') # Plus something to pass the header message
return render_template('buy.html')
I already know about using redirect() and url_for() together but I'd prefer if there's a way to do this without changing the URL address.
Thanks for any help in advance!

