user23611955
user23611955

Reputation: 3

formatting values in SQLFORM

I have a field db.Schedule.Rate defined as type='double', I am trying to display it with SQLFORM so that a user can edit the values of a selected record. However, when the Rate value is too low (for example 0.00008) it is displayed in scientific notation (8e-05.00) instead. Is there way to format it/display it as 0.00008 with SQLFORM?

In the table definition I am using this code to format it

db.Schedule.Rate.represent = lambda value, row: '{:.10f}'.format(Decimal(value)).rstrip('0').rstrip('.') if value is not None else None

and when the data is displayed in SQLFORM.grid it is formatted correctly, however in the SQLFORM edit function this does not work.

Upvotes: 0

Views: 21

Answers (0)

Related Questions