On Saturday, August 5, 2017 at 4:12:43 PM UTC-4, Vic Ding wrote:
>
> Thanks for the help, it works. However, this alters the table definition.
> 1) Is there a way that the value is only set temporarily ?
>
You can set db.customer._format and db.sales_order.customer.requires
anywhere you want.
> 2) When the address field is empty, can I use other fields , like city,
> country and etc?
>
The "_format" attribute and the third argument to IS_IN_DB can be a
function that takes a row object and returns whatever you want:
def represent_customer(row):
...
return something
db.customer._format = represent_customer
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.