Thanks Massimo once again!

On Tuesday, August 21, 2012 9:03:45 PM UTC+8, Massimo Di Pierro wrote:
>
> Do you mean something like this?
>
> activities = {1:'diving',2:'swimming',3:'skiing'}
> ....
> Field('activity_id','integer',requires=IS_IN_SET(activities),represent=lambda 
> i: activities[i]) 
>
> On Tuesday, 21 August 2012 04:24:09 UTC-5, lyn2py wrote:
>>
>> Hi guys,
>>
>> db.define_table('activities', 
>>     Field('name', 'string',length=255,requires=IS_NOT_EMPTY()),
>>     Field('description','text'),
>>     format='%(name)s'
>>
>> )
>>
>> db.define_table('activity', 
>>     Field('user_id','reference auth_user',default=auth.user_id),
>>     Field('activity_id','reference activities'), 
>> )
>>
>>
>> Instead of the above code, can I have the second table reference a list / 
>> tuple instead of a table? How should I do it?
>>
>

-- 



Reply via email to