Mark Hayes
unread,Feb 7, 2011, 2:43:34 AM2/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
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!