On Thursday, December 10, 2015 at 3:48:44 AM UTC-5, Massimiliano wrote:
>
> Take a look here:
>
>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#One-to-many-relation
>
> You will find that you need to set the *format* value for the table 
> leader just to inform web2py how to represent the record.
>
> So in your example:
>
> db.define_table(‘LEADER’,
>                 … your fields,
>                 format=‘%(yourfield)s’)
>
>
> where *yourfield* is the LEADER’s field that you want to see instead the 
> id.
>

Note, by specifying the "format" argument in the LEADER table definition, 
that will give you a default IS_IN_DB validator as well as a default 
"represent" function for any reference field that references the LEADER 
table. The IS_IN_DB validator itself is responsible for generating the 
select widget in forms.

Alternatively, you could explicitly define your own IS_IN_DB validator 
and/or "represent" function. You could also explicitly define your own form 
widget by specifying the "widget" argument in the field definition.

All of these options are documented in the book.

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.

Reply via email to