these are not "translation problems", these are "how do I manage a default value....". Before creating the update form, just see if the value is the default one and replace it with None.
On Saturday, December 8, 2012 2:41:23 AM UTC+1, Luca wrote: > > Suppose I want to store some data in the database, defining my own > translation from user-defined strings to db representation, and vice versa. > Obviously this may not work for search, but leave search aside. > > To translate from user input to db representation, I can use the compute= > attribute of a Field. > But how can I translate from db representation to editable string? There > is represent= , but it does something else. > > The context in which I need this is dates. > I would like that, if a user leaves a date blank, I replace it in the db > with a certain date (for instance, Year = MINYEAR, or YEAR = MAXYEAR, to > imply that the date is far in the past or future, so that searches with < > > will work properly). But, when the user edits the field, I want to > restore the blank field, not have them edit a date of Jan 1, 0000 ! That > would be illogical, since they never entered that date. > > This is a very general problem I imagine. Is there a way to define such > translations between stored and editable values in web2py? Can it be > added? Where would one go to add it? > > Luca > --

