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


Python Form.validate_on_submit方法代碼示例

本文整理匯總了Python中forms.Form.validate_on_submit方法的典型用法代碼示例。如果您正苦於以下問題:Python Form.validate_on_submit方法的具體用法?Python Form.validate_on_submit怎麽用?Python Form.validate_on_submit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在forms.Form的用法示例。


在下文中一共展示了Form.validate_on_submit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: racimos_faltantes

# 需要導入模塊: from forms import Form [as 別名]
# 或者: from forms.Form import validate_on_submit [as 別名]
def racimos_faltantes():
    form = Form(request.form)
    _populated_select(form)
    if form.type.data =='1':
        cur.execute("SELECT id, peso, item, fecha, orden, cod_empacadora, peso_neto, peso_bruto, cod_item_corto, cod_hacienda, "
                    "ROUND(AVG(peso),2) as promedio, COUNT(orden) as total_cajas, cantidad, ROUND(MIN(peso),2) as minimo, "
                    "ROUND(MAX(peso),2) as maximo, ROUND(AVG(peso_bruto),2) as promedio_bruto FROM caja ")
    if form.type.data =='2':
        cur.execute("SELECT id, peso, item, fecha, orden, cod_empacadora, peso_neto, peso_bruto, cod_item_corto, cod_hacienda, "
                    "ROUND(AVG(peso),2) as promedio, COUNT(orden) as total_cajas, cantidad, ROUND(MIN(peso),2) as minimo, "
                    "ROUND(MAX(peso),2) as maximo, ROUND(AVG(peso_bruto),2) as promedio_bruto "
                    "FROM bandeja WHERE DATE(fecha)='$fecha_consulta' GROUP BY orden, cod_item_corto ORDER BY "
                    "cod_empacadora, orden")
    if form.type.data =='3':
        cur.execute("SELECT r.idracimo, r.idconvoy, r.peso, r.timestamp as fecha_racimo, r.numlote as lote_racimo, "
                    "r.cinta, r.edad, r.cod_empacadora, r.cod_hacienda, r.tara, c.timestamp as fecha_convoy,c.num_racimos, "
                    "c.cuadrilla, COUNT(peso) as cantidad_pesada, ROUND(AVG(tara),2) as prom_tara, "
                    "ROUND(MIN(CAST(peso AS DECIMAL)),2) as minimo, ROUND(MAX(CAST(peso AS DECIMAL)),2) as maximo, "
                    "ROUND(AVG(CAST(peso AS DECIMAL)),2) as peso_promedio from racimo r left join convoy c ON(r.idconvoy=c.idconvoy) "
                    "WHERE DATE(r.timestamp)='"+form.date.data+"' GROUP BY r.idconvoy, r.numlote, r.cinta")
        cur.execute("SELECT r.idracimo, r.idconvoy, r.peso, r.timestamp as fecha_racimo, r.numlote as lote_racimo, "
                    "r.cinta, r.edad, r.cod_empacadora, r.cod_hacienda, r.tara, c.timestamp as fecha_convoy,c.num_racimos, "
                    "c.cuadrilla, COUNT(peso) as cantidad_pesada, ROUND(AVG(tara),2) as prom_tara, "
                    "ROUND(MIN(CAST(peso AS DECIMAL)),2) as minimo, ROUND(MAX(CAST(peso AS DECIMAL)),2) as maximo, "
                    "ROUND(AVG(CAST(peso AS DECIMAL)),2) as peso_promedio from racimo r left join convoy c ON(r.idconvoy=c.idconvoy) "
                    "WHERE DATE(r.timestamp)='"+form.date.data+"' GROUP BY r.cinta")
    if not form.type.data == 'None':
        data= cur.fetchall()
    else:
        data= []
    if not form.validate_on_submit():
        flash('Ingresar bien todos los campos')
    return render_template('racimos_faltantes.html',form=form, data=data)
開發者ID:Manexware,項目名稱:reybanpac_rb_report,代碼行數:35,代碼來源:__init__.py


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