Model:
---------
db.define_table('tbls',
  SQLField('name'))

db.define_table('xref',
  SQLField('table_id','reference tbls'),
  SQLField('entry_id','integer'))

db.define_table('tbl1',
  SQLField('info1'))

db.define_table('tbl2',
  SQLField('info1'),
  SQLField('info2'))

db.define_table('tbl3',
  SQLField('info1'),
  SQLField('info2'),
  SQLField('info3'))

dt=[t for t in db.tables if t not in ['tbls','xref']]
db.tbls.name.requires=IS_IN_SET(dt)

db.xref.table_id.requires=IS_IN_DB(db,db.tbls.id,'%(name)s')

Controller:
-------------
def insert_entry():
   # some form/forms here that select which table to make an entry in
and display a create form for it, updating entry_id afterwards.

I hope this makes it more understandable.



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

Reply via email to