I have tables with individual properties, db.define_table('article', Field('title', 'string', length=255,required=True), Field('description', 'text',required=True), ) db.define_table('post', Field('title', 'string', length=255,required=True), Field('description', 'text',required=True), ) db.define_table('page', Field('title', 'string', length=255,required=True), Field('description', 'text',required=True), )
And I have a table with many-to-many relationship (with different tables): db.define_table('action', Field('user_id','reference auth_user',default=auth.user_id,required=True), Field('action','string',requires=IS_IN_SET(('fav','subscribe','report','follow')),required=True), Field('table',requires=???,required=True), Field('table_id','integer',default=???,required=True), ) My questions: 1.. The field, "table" is actually one of the tables, article/post/ page. Is the only correct way to use requires=IS_IN_SET(('article','post','page')) ? 2.. "table_id" is actually dependent on the "table" selected. what should I put for "default=???" 3.. Can I set a different set of IS_IN_SET for "action" field, depending on the "table" field chosen? 4.. Finally, if the above is the wrong approach, how should I do it correctly (best practice?) Thanks!