I'm new to web2py and can't seem to find out how to create a composite
key. Specifically I'm trying to create the following tables:
db.define_table('volunteer',
Field('first_name', 'string', length=30, notnull=True),
Field('last_name', 'string', length=30, notnull=True),
Field('birthday', 'date', required=True),
Field('email', 'string', length=30))
db.define_table('opportunity',
Field('name', 'string', length=30, notnull=True))
db.define_table('interest',
Field('volunteer', db.volunteer),
Field('opportunity', db.opportunity))
In the 'interest' table I want to ensure that the combination of both
volunteer + opportunity is unique. What is the best way to go about
doing this? Any help would be greatly appreciated, thanks!