Web2py AJAX 自动完成和 auth.user_id
这些表
db.define_table('sender',
Field('id'),
Field('user_id', auth.user_id),
Field('name'), # e.g. Daniel
Field('email'),# e.g. [email protected]
Field('opening'), # e.g. Dear Daniel
...)
db.define_table('receiver',
Field('id'),
Field('user_id', auth.user_id),
Field('name'), # e.g. John
Field('email'), # e.g. [email protected]
Field('tel'), # e.g. 111 222 111
...)
db.define_table('letter',
Field('id'),
Field('user_id', auth.user_id),
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"
...)
我得到了我使用的
db.letter.opening.widget = SQLFORM.widgets.autocomplete(request, db.receiver_profile.opening, id_field=db.receiver.id)
:它显示了存储在接收器中的所有值,但我只想显示用户拥有的值(db(db.receiver.user_id==auth. user_id).select(db.receiver.opening))
I got these tables
db.define_table('sender',
Field('id'),
Field('user_id', auth.user_id),
Field('name'), # e.g. Daniel
Field('email'),# e.g. [email protected]
Field('opening'), # e.g. Dear Daniel
...)
db.define_table('receiver',
Field('id'),
Field('user_id', auth.user_id),
Field('name'), # e.g. John
Field('email'), # e.g. [email protected]
Field('tel'), # e.g. 111 222 111
...)
db.define_table('letter',
Field('id'),
Field('user_id', auth.user_id),
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"
...)
i used this :
db.letter.opening.widget = SQLFORM.widgets.autocomplete(request, db.receiver_profile.opening, id_field=db.receiver.id)
it shows all values stored in receiver
but i want to show only the values that's owned to the user (db(db.receiver.user_id==auth.user_id).select(db.receiver.opening))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
替换
为
replace
with