Try This Hope this will help you db.define_table('city', Field(''city_name'),format='%('city_name)s')
db.define_table('shop', Field('name'), Field('city','reference parent')) db.children.city.requires = IS_IN_DB(db, db.parent.id,'%(name)s') On Thursday, 4 July 2013 04:26:56 UTC+5:30, Kamil wrote: > > Hello guys, > > I tried SQLFORM.grid for a while and couldn't figure out if it's possible > to do the following: > > 1) Let's say we have a tables: > > db.define_table('shop', > Field('shop_name'), > Field('city_id', 'reference city') > ) > db.define_table('city', > Field('city_name') > ) > > and > > grid = SQLFORM.grid((db.shop, left=db.shop.on(db.shop.city_id == > db.city.id), fields=[db.shop.shop_name, db.city.city_name]} > > so we have grid with cols shop_name and city_name. But when we choose add > or edit we will get a form with shop_name and city_id. Is there any easy > way to have there selectable list with city_name's instead of id's? I know > the way of creating custom link for e.g. editing with entirely own logic > and editable=False. > > 2) create custom orderby statement e.g. 'Monday' < 'Tuesday' < ... > > 3) There is a field with requires=IS_IN_SET(...). SQLFORM.grid generates > then input type=select. When we append another validator input becomes > simple text box. I have two such fields and have to validate if first < > second. How to add this validator and still be able using select box? > > Thanks in advance. > > Cheers, > Kamil > -- --- 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/groups/opt_out.