Hi,

I have the following table structure in my db.py.

db.define_table('table_a',
    Field('x_id', db.table_x),
    Field('name', length=200, required=True),
    Field('description', length=300),
    Field('displayorder', 'integer', required=True),
    format='%(name)s')

db.define_table('table_b',
    Field('name', length=45, required=True),
    Field('description', length=200),
    format='%(name)s')

db.define_table('a_b',
    Field('a_id', db.table_a),
    Field('b_id', db.table_b),
    Field('displayorder', 'integer', required=True),
    format='%(id)s')

db.define_table('user',
    Field('user_id', 'integer', required=True),
    Field('name', length=60, required=True),
    format='%(name)s')

db.define_table('table_c',
    Field('a_b_id', db.a_b),
    Field('user_id', db.user),
    Field('content', 'text', required=True),
    Field('content', 'text', required=True))

db.table_c.a_b_id.requires = IS_NOT_IN_DB(db, db.a_b)

Here, 'table_a' and 'table_b' have many to many mapping. Table 'a_b'
is the mapping table. Now in
'table_c', I am referring to table 'a_b'. (the mapping table)

While inserting into 'table_c', I am not getting the drop down for the
'a_b_id' column. But for the 'user_id' column, I am getting the drop
down. I am not sure where things are going wrong. Any help is
appreciated.

Ideally I would like the combination of a.name and b.name in the drop
down for 'a_b_id' in the 'table_c'

By the way, web2py is an amazing piece of work. So far my experience
has been great.

Thanks,
Steve.

Reply via email to