On Friday, April 20, 2018 at 2:30:22 PM UTC-4, Richard wrote: > > Realize that, though I am sure it use to managed it... >
Not going back to at least web2py 2.02, as far as I can tell. > Anyway, I find it curious that even if I have field of type decimal(10, 2) > for instance, if I insert 1.304, and submit the form it ends up with 1.304 > in the read form (backend has 3 places). > As far as I can tell, the decimal specification in the "type" argument to Field() is used only for migrations -- that is, when the DAL is creating the column in the database. If the backend is pre-existing with 3 decimal places and the DAL does not run any migrations, then the decimal specification will have no effect. It is not used for transforming input or output. > How do we validated the number of places?? > You could create a custom validator. If the inputs are strings, you'll have to count the number of digits after the decimal point. If the inputs are Decimal objects, value.as_tuple().exponent will give you the significant digits (as a negative number). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

