wtforms ReferencePropertyField 设置已选择
使用 GAE-helper ReferencePropertyField 显示用户可能所在的组。
编辑用户时如何使其显示用户当前所在的组?
选择字段工作正常,我可以更改用户组并将更改写入数据存储区,但我不知道如何在重新渲染表单时设置当前值。
我尝试过使用
form.field.data = current_data
但没有运气。
有人有主意吗?
Using the GAE-helper ReferencePropertyField to show possible groups that a user can be in.
How do I make it show the what group the user currently is in when editing the user?
The selectfield works fine, I can change the group of the user and the changes are written to the datastore, but I can't figure out how to set the current value when redering the form.
I have tried using
form.field.data = current_data
but with no luck.
Anyone have an idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
current_data 是字符串吗?如果不尝试使用
str(current_data)
进行转换,我在使用实体键或 id 作为SelectField
上的值时遇到了类似的问题。Is
current_data
a string? If not try usingstr(current_data)
to convert, I had a similar issue using either entity keys or ids as values on aSelectField
.