Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class myForm(FlaskForm):
- def __init__(self, *args, **kwargs):
- super(myForm, self).__init__(*args, **kwargs)
- @app.route('/search')
- def search():
- class F(myForm):
- pass
- fields = {'mytext': wtforms.TextField('myText'),
- 'myselect': wtForms.SelectField('mySelect', choices = [(1, 'a'), (2, 'b')])
- }
- for key, val in fields.iteritems():
- setattr(F, key, val)
- form = F()
- return render_template('search.html',
- form=form)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement