librelist archives

« back to archive

WTForms populate_obj

WTForms populate_obj

From:
Dan Jacob
Date:
2010-05-19 @ 20:27
The WTForms example in the documentation shows how to bind form
variables to an object:

user = User(form.username.data, form.email.data,
            form.password.data)

WTForms also has a convenience method, populate_obj, which does the same:

user = User()
form.populate_obj(user)

http://wtforms.simplecodes.com/docs/0.6/forms.html#wtforms.form.Form.populate_obj