Hi everyone, this is my first message on the googlegroup.
In the web2py book, computed fileds are described with this
explanation :
When a new record is modified, including both insertions and updates, if
a value for the field is not provided, web2py tries to compute from the
other field values using the compute function.
>From that I understood That for my application a computed filed would be
great. Here's the simplified db table concerned:
db.define_table("article",
Field("nom"),
Field("description","text"),
Field("price_with_taxes", compute=lambda r: r.price*(1
+r.taxes)/100),
Field("price",default=0),
Field("taxes",default=20))
I'd like to give the opportunity for the person inserting or updating an
article field to provide the price or the price_with_taxes, so that the
missing other field is computed from the provided one. I'm trying for
now to get the price_with_taxes computed, providing the price, but as
soon as I add the compute attribute, the price_with_taxes field is no
more displayed by the database admin form. Am I missing something? Why
isn't the field displayed?
Thank you for any help.
--
Pierre-Antoine ROIRON
ARTISAN LUTHIER
37, rue Sébastien Gryphe
www.guitares-roiron.com - ic?facebook
+33(0)4.78.58.23.64
userbar Guitares Roiron