當前位置: 首頁>>代碼示例>>Python>>正文


Python file.FileField方法代碼示例

本文整理匯總了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 
開發者ID:cobbr,項目名稱:Judge,代碼行數:21,代碼來源:judge.py


注:本文中的flask_wtf.file.FileField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。