Massimo and web2py.experts, After initial successful tests with web2py we are trying to get the first 'little' enterprise application done with it. And like enterprises do we need to life with extensive use of multi column unique keys. Despite reading through various threads on this we could not get it working already with a 'simple' 2 column unique key. Either we loose the "drop box" option/functionality or we can't use it as one column of a multi column unique key. See the last 3 lines of the following code example. I'm sure someone here can share a working example of how to implement such a basic enterprise requirement in web2py code.
Beyond that I would appreciate help on how a good code for a 3 column unique key would be implemented (a good example would be shapename +colorname+month below). Thanks, Hans db=SQLDB('sqlite://test.db') db.define_table('shape', SQLField('name'), migrate='shape.table') db.define_table('color', SQLField('name'), migrate='color.table') db.define_table('shapecolor', SQLField('shapename'), SQLField('colorname'), SQLField('month','date',requires=IS_DATE('%Y-%m')), migrate='shapecolor.table') db.shapecolor.shapename.requires=IS_IN_DB(db,db.shape.name,'%(name) s') # 1st try db.shapecolor.colorname.requires=IS_IN_DB(db,db.color.name,'%(name) s'),IS_NOT_IN_DB(db (db.shapecolor.shapename==request.vars.shapename),'shapecolor.colorname') #<<< this breaks db.color.name dropdown # 2nd try db.shapecolor.colorname.requires=[IS_IN_DB(db,db.color.name,'%(name) s'),IS_NOT_IN_DB(db (db.shapecolor.shapename==request.vars.shapename),'shapecolor.colorname')] #<<< this breaks db.color.name dropdown as well # 3rd try db.shapecolor.colorname.requires=IS_IN_DB(db,db.color.name,'%(name) s') #<<< dropdown working but no multi column unique key! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---