I would like make one to one tables relation. For example:

db.define_table('contract',
    Field('num', unique=True, notnull=True'),
    ...

db.define_table('student',
    Field('contract', db.contract, unique=True, notnull=True, 
label='Договор'),

But unique and notnull options doesnt reflects in database.

In generally, how I can make one to one relation? I've tried the following 
approach:

db.student.contract.requires = IS_NOT_IN_DB(db, 'student.contract')
db.student.contract.requires = IS_IN_DB(db, db.contract.id, '%(num)s')

but the first requirements (IS_NOT_IN_DB) doesn't work.


-- 



Reply via email to