I'm having trouble populating a form using a dictionary:
row = {'firstname':'Bob', 'lastname': "Smith",
'email': '[email protected]', 'phone': '512.999.1212'}
form = RolodexEntry(obj=row)
doesn't put any data into form (i.e. form.firstname.data = None after the preceding).
The top of the form definition is shown below. I'm at a loss for what to try next. The form documentation just says:
obj – If formdata is empty or not provided, this object is checked for attributes matching form field names, which will be used for field values.
class RolodexEntry(Form):
firstname = TextField('First Name',[validators.length(max=40)],
filters=[strip_filter])
lastname = TextField('Last Name', [validators.length(max=40)],
filters=[strip_filter])
email = TextField('Email', [validators.Optional(),
validators.length(max=25),
validators.Email()],
filters=[strip_filter])
...
process
is a bad idea. One can simply pass the dictionary as**row
to the Form constructor if a dict is required. – Luht