db.table2.field_1.requires = IS_IN_DB
<http://localhost:8000/examples/global/vars/IS_IN_DB>(db,db.table_1.field_1,'%(field_1)s')
On Thursday, March 29, 2018 at 9:20:34 AM UTC-7, LoveWeb2py wrote:
>
>
> How can I select a foreign key and represent the value? I want to
> represent the entire group and now have to do individual queries for each
> foreign key. Is that possible?
>
> db.define_table('table1',
> Field('field_1'),
> format='%(field_1)s')
>
> db.define_table('table2',
> Field('field_1', 'reference table1'),
> Field('field_2', 'string),
> format='%(field_1)s')
>
> So in this example I would do data = db(db.table1).select() which returns
> a rows object. But the reference table1 returns an integer instead of the
> actual value stored in the field.
>
> How could I retrieve the value instead of the integer and is it possible
> to do it in bulk?
>
--
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.