Hi Puska,

> When I add a proposer into a database and refresh the "new" page
> proposer_id SingleSelectField does not get updated.

That's because your get_proposer_id_options() gets executed only once.
You need to make sure that it gets evaluated for each request.
You can use the prepare() method of a ToscaWidgets widget for that (you will
need to subclass SingleSelectField then, but that's not too difficult).

> i also tried to use DbSingleSelectField from tw2.sqla but then I have
> problems with setting initial values for the field (it needs to be an
> instance of Porposers, not an id value) and validating values (
> DbSingleSelectField returns an instance of Porposers, not an id).

Well that's the expected behaviour for the validator for DBSingleSelectField -
giving you the respective object of your model from your database. Therefore you
will also need to set an object as value.
On the other hand, if you want to work with plain SingleSelectFields, you will
need to stick to id values and set the names for the entries per hand.
If you play around with that a little you will see how it works, hopefully.

Feel free to get inspired by this example from my application where it works:
https://github.com/moschlar/SAUCE/blob/develop/sauce/widgets/submission.py
Especially the LanguageSelectField should do something similar to what you are
trying to achieve.

Regards,
Moritz

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to