Python web2py中的三字段复合键

Python web2py中的三字段复合键,python,web2py,composite-key,Python,Web2py,Composite Key,我有三个字段在一个表中必须是唯一的,并且基于我尝试了以下内容(我想我理解这一点,但显然不是…monkey see,monkey do): 这三个字段是Person、Certification和Start_date。当我尝试使用此功能时,我得到: “个人认证” 回溯引用“requires”行。(表中已经有数据(三个字段中没有重复的数据);代码是否在SELECT过程中尝试进行检查?) 我在这里缺少什么?抱歉,原始答案不正确(现在修复)。由于该表尚未定义,因此不能在表定义本身中引用它。相反,在表定义之

我有三个字段在一个表中必须是唯一的,并且基于我尝试了以下内容(我想我理解这一点,但显然不是…monkey see,monkey do):

这三个字段是Person、Certification和Start_date。当我尝试使用此功能时,我得到:

“个人认证”

回溯引用“requires”行。(表中已经有数据(三个字段中没有重复的数据);代码是否在SELECT过程中尝试进行检查?)


我在这里缺少什么?

抱歉,原始答案不正确(现在修复)。由于该表尚未定义,因此不能在表定义本身中引用它。相反,在表定义之后设置验证器:

db.Person_certification.start_date.requires = IS_NOT_IN_DB(...)

抱歉,原始答案不正确(现已修复)。由于该表尚未定义,因此不能在表定义本身中引用它。相反,在表定义之后设置验证器:

db.Person_certification.start_date.requires = IS_NOT_IN_DB(...)

完美的还必须用括号括起以下术语:db.Person_certification.Start_date.requires=IS_NOT_IN_db(db((db.Person_certification.Person==request.vars.Person)&(db.Person_certification.certification==request.vars.certification)),“Person_certification.Start_日期”);完美的还必须用括号括起以下术语:db.Person_certification.Start_date.requires=IS_NOT_IN_db(db((db.Person_certification.Person==request.vars.Person)&(db.Person_certification.certification==request.vars.certification)),“Person_certification.Start_日期”);