当前位置: 首页>>代码示例>>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;未经允许,请勿转载。