本文整理汇总了Python中flask_wtf.file.FileField方法的典型用法代码示例。如果您正苦于以下问题:Python file.FileField方法的具体用法?Python file.FileField怎么用?Python file.FileField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_wtf.file
的用法示例。
在下文中一共展示了file.FileField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_dns_service
# 需要导入模块: from flask_wtf import file [as 别名]
# 或者: from flask_wtf.file import FileField [as 别名]
def add_dns_service():
"""
The AddDNSServiceForm posts to this page. Add a DNS service to the database, and redirect back to the configure page.
"""
form = AddDNSServiceForm(request.form, csrf_enabled=False)
if app.config['ALLOW_CONFIG']:
choices = [(team['team_id'], team['team_name']) for team in db.execute_db_query('select team_id, team_name from team')]
form.team_name.choices = choices
if form.validate():
service_type_id = db.execute_db_query("select service_type_id from service_type where service_type_name = 'dns'")[0]['service_type_id']
team_id = form.team_name.data
db.execute_db_query('INSERT INTO service(service_type_id, team_id, service_name, service_connection, service_request, service_expected_result) VALUES(?, ?, ?, ?, ?, ?)', [service_type_id, team_id, form.service_name.data, form.service_connection.data, form.service_request.data, form.service_expected_result.data])
else:
flash('Form not validated')
else:
return redirect(url_for('scoreboard'))
return redirect(url_for('configure'))
# WTF-Form FileField not working, doing all validation manually for this route