flask wtforms 中表单怎么改css

如题所述

视图函数中传递若干个form实例到html页:

@app.route('/test/')def test(): form1 = TestForm1() form2 = TestForm2() return remder_template('test.html',form1=form1,form2=form2)<form action="/test1/ method="post"> {{ form1.field() }} <input type="submit" value="提交" /></form> <form action="/test2/ method="post"> {{ form2.field() }} <input type="submit" value="提交" /></form>

再编写两个视图函数分别接收form1,form2提交的数据:

@app.route('/test1/', method=['POST'])def test1(): # 处理代码 @app.route('/test2/', method=['POST'])def test2(): # 处理代码
温馨提示:答案为网友推荐,仅供参考