flask一个表单,两个按钮

if form.validate_on_submit(): #验证是否通过
newstitle =form.newstitle.data
if form.getwords.data: # 按钮1
stopwords=form.stopwords.data.split(',')
content=form.newscontent.data
wordlist=get_wordlist(content,int(form.sumselect.data),stopwords)
return render_template('input.html',form=form)
else: # 按钮2
print('data='+str(form.selectwords.data))
return 'You click the "save" button.'
else:
return '验证有误'
posted @ 2020-12-06 21:00  风中的太阳  阅读(67)  评论(0)    收藏  举报