我有一个我想根据来自数据库的信息和填充字段自动填充它:
在 db_wizard.py
db.define_table('sender',
Field('name'), # e.g. Daniel
Field('email'),# e.g. daniel@daniel.com
Field('opening'), # e.g. Dear Daniel
...)
db.define_table('receiver',
Field('name'), # e.g. John
Field('email'), # e.g. John@john.com
Field('tel'), # e.g. 111 222 111
...)
db.define_table('letter',
Field('sender', db.sender.id), # e.g. Daniel
Field('receiver', db.receiver.id), # e.g. John
Field('opening'), # should be filled automatically when choosing/changing the value of "sender"
...)
所以letter.opening
应该得到 的值receiver.opening[letter.sender.id]
,这意味着opening
选择的值sender