Below example can show the behavior, please do not mind over the table 
logic/names (this is just to show the  behavior)


*Model:*
db.define_table('person', 
    Field('name'), 
    Field('country'))

db.define_table('dog',
    Field('name'),
    Field('ownername', 'reference person'))
    
db.dog.ownername.requires = IS_IN_DB(db,db.person.id, '%(name)s')

*Controller:*

def testpage():
    grid = SQLFORM.smartgrid(db.dog,csv=False,linked_tables=['person'],)
    return dict(grid=grid)     

*View:*

{{=grid}}


*Problem1 :- Referenced field id is seen in grid, I want to have the 
referenced field 'name' value*

Please insert few records using appadmin/grid and view the records, it will 
show the NAME field (DOG table) having the value as ID for the PERSON 
table. How can I view the name of the person name here and not the ID from 
PERSON table.

*Problem2: In my case, Person field can have duplicate names, i.e. multiple 
records with the same name can be present. But I want that in DOG table, 
unique name to be seen in drop down list (seen in edit/add record).*

Please advise on how this can be accomplished.

-Sarbjit






-- 
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