You normally would pass in a multi-dict object containing the form data as the first argument to the form:
form = UpdateWidgetForm(request.form)
this does require that the POST
data matches the widgets in the form; each widget will inspect that multi-dict and pull out what it needs to render with some pre-populated data.
Alternatively, you can pass in values as keyword arguments, but that does require you've validated the input yourself, converting any values to the right types:
number = request.form.get('widget_number')
try:
number = int(number)
except ValueError:
abort(404)
policy = request.form.get('widget_policy')
if policy not in ('foo', 'bar'):
abort(404)
form = UpdateWidgetForm(widget_number=number, widget_policy=policy)
See How Forms get data in the documentation.
If you need to generate multiple forms within a page, each unique, from the same form object, you need to give them each a unique prefix with the Form(prefix=..)
argument.