Hi.

Sorry about that, but I'm gone ask for something already asked before, 
displaying the reference field in the grid instead of the id:
https://groups.google.com/forum/#!searchin/web2py/how$20to$20display$20the$20value$20of$20a$20reference$20field$2C$20instead$20of$20the$20id$20in$20sqlform.grid/web2py/obVOrS7tKTs/JYgWXYqV6JEJ

So here is my db:
db.define_table('products',
                Field('id_01', type='integer', unique=True),
                Field('code', unique=True),
                format='%(code)s')

db.define_table('enquiries',
                Field('user_id'),
                Field('product_id_01', 'reference products', requires = 
IS_IN_DB(db, db.products.id_01, '%(code)s')),
                Field('quantity', type='integer'))

My controller:
def enquiries():
    query= db.products.id_01 == db.enquiries.product_id_01
    grid=SQLFORM.grid(query=query)
    return dict(grid=grid)

My view:
{{extend 'layout.html'}}
{{=H3(T('Your enquiries'))}}
{{=grid}}

Like that web2py display enquiries.product_id_01 in grid. How can web2py 
could display products.code instead of enquiries.product_id_01 in grid ?

Thanks.

-- 
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/groups/opt_out.

Reply via email to