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. Ciao On Thu, Dec 10, 2015 at 1:35 AM, Alessandro Leonetti < ale.leonett...@gmail.com> wrote: > Good evening, > > I'm running into a problem quite uncomfortable but I'm pretty sure there > is a fairly simple way to resolve it. > I defined the various tables within my database and put them in relation > with each other (one to many, many to many etc.). > The problem is that when I insert a new record in a table that requires me > to a field in another table, I have to specify that field in the record ID > which will be linked to the record that I am creating. > > Example: > > Tables: Worker & Leader > I want to specify, creating a new record in the table worker who is the > head of the worker that I am entering: > > Name: BOB > Surname: DYLAN > Leader: 3 ----------------------> HOW DO I APPEAR TO A MENU 'CURTAIN FROM > WHICH CAN CHOOSE ONE OF THE LEADERS ALREADY' INCLUDED IN THE DATABASE > INSTEAD OF DOVER INSERT EXACT LEADER ID ??? > > Dovrò specificare qualcosa all'interno di > db.define_table('Worker', > Field('Name',requires=IS_NOT_EMPTY()), > Field('Surname',requires=IS_NOT_EMPTY()), > Field('LEADER', db.LEADER .............................. > ) > ????? > > Thanks for any answers, it would be great if you could help me, I'm losing > a lot of time! > > Best Regard and sorry for my disappointing english, > Alessandro > > -- > 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 web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Massimiliano -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.