2021-10-06 python学习 flask 的form学习之三,一个小form 123456789101112131415class MockCreate(Form): user_email = StringField("email address",[validators.Email()]) api = StringField("api",[Required()]) submit = SubmitField("Submit") code = IntegerField("code example: 200",[Required()]) alias = StringField("alias for api") data = TextAreaField("json format",[Required()])@app.route("/mockservice",methods=['GET','POST'])def MockController(): form = MockCreate() code = form['code'] api = form['api'] return render_template("testf.html",api=api,data=code) 下一篇 streamlit学习笔记五-----多个小部件分组 上一篇 flask全局变量一,视图间的参数传递