Post an array of objects from an HTML form using Flask?
This question already has an answer here:
form.data
For eg
Consider the form defined as below,
class GeneralForm(FlaskForm):
boolean_val = BooleanField('Boolean')
a_float = FloatField('Severity')
submit = SubmitField('Submit')
In the app route,
@app.route('/wtforms', methods=['GET', 'POST'])
def debug_wtforms():
form = GeneralForm()
if request.method == 'POST' and form.validate_on_submit():
print(form.data) # Form data as a dict
return render_template('index1.html', form=form)
request.form.to_dict(flat=False)
I hope this helps.
链接地址: http://www.djcxy.com/p/21928.html上一篇: 防止页面内的按钮在点击时刷新页面