I'm not entirely sure what you are after here. Do you want the
SingleSelectField to be pointing to the value the user selected before
submitting the form?
Then don't use redirect. Redirect forces the browser to load the page from
scratch - so how should TG know what value to select?
Instead, use the @validate-decorator with the form, and a proper error_handler
that re-displays the form. It will then automatically get the user-filled-in
values.
Diez
The problem is that you query your datasets while *constructing* the
widget. Which is of course only run once.
What you should do instead is passing callables to your SSFs, like this:
def get_projects():
return [(p.id, p.name) for p in Project.query.all()]
...
SingleSelectField(options=get_projects)
That ensures that the list of actual options is determined on render-time.
Diez