使用 Flask,我可以访问函数 poll() 中的 request.form 数据,但是在重定向之后,request.form 是空的。
我确定这是故意的,我必须明确地通过它,但是如何?
from flask import render_template, redirect, request
from app import app
from forms import PollForm
@app.route('/poll', methods = ['GET', 'POST'])
def poll():
form = PollForm()
if form.validate_on_submit():
print request.form # returns ImmutableMultiDict with data
return redirect('/details')
return render_template('poll.html', form=form)
@app.route('/details')
def details():
print request.form # returns empty ImmutableMultiDict
return render_template('details.html')