I see what you mean. In that case, you don't want to reference the other
table, since you don't have a many to many table.
For many to many relationships, you should have three tables.
table_one
table_two
table_relationship_between_one_and_two
But if you just want a list of the strings like so: '%(first)s -
%(second)s Against %(third)s'
What you wrote should work, based on what it says in the documentation, the
defaults should be sufficient. You can try this -- add:
db.table_two.requires=IS_IN_DB(db,table_one.id, db.table_one._format,
multiple=True)
That's just explicitly defining what should be the default...
On Friday, March 30, 2012 1:49:12 PM UTC-7, pjryan126 wrote:
>
> Derek:
>
> Thanks for your response. It's a many-to-many relationship between
> table_one and table_two. i was hoping to denormalize this relationship with
> list:reference, but maybe it's more trouble than it's worth in this case.
>
> On Friday, March 30, 2012 3:38:23 PM UTC-4, pjryan126 wrote:
>>
>> I have the following two tables:
>>
>> db.define_table('table_one',
>> Field('first', db.first, '%(name)s'),
>> Field('second', db.second, '%(name)s'),
>> Field('third', db.third, '%(name)s'),
>> format = '%(first)s - %(second)s Against %(third)s')
>>
>> db.define_table('table_two',
>> Field('fourth', db.fourth),
>> Field('fifth', db.fifth),
>> Field('table_ones', 'list:reference table_one'),
>> Field('sixth', list:string)
>>
>> When I go to add a record to the db.form table in appadmin, the
>> db.form.plan_classes drop-down box populates using the id's in the
>> respective db.table_one fields (i.e., "1 - 1 Against 2", etc).
>>
>> How would I get the items in the db.table_two.table_ones list to appear
>> in a drop-down box using the field representations assigned in the
>> db.table_one table definition? Any help on this would be greatly
>> appreciated!
>>
>