web2py 中的组成员资格表单
web2py 有一个很好的 RBAC 系统以及许多内置的表单来管理用户。我找不到一个来管理群组成员身份的人。我意识到 appadmin 中有一个,但我需要在我的应用程序中使用一个。理想情况下,我希望在用户注册/个人资料页面中看到不同组的复选框。
我怎样才能做到这一点?
web2py has a nice RBAC system as well as many built-in forms to manage users. I can't see to find one to manage group membership. I realize there's one in appadmin, but I need to use one in my app. Ideally, I'd like to see checkboxes for the different groups in the user registration/profile page.
How can I accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为没有为此内置任何标准,但您可以使用 Crud,或者使用 SQLFORM.grid / SQLFORM.smartgrid< /a>.例如:
或者
如果您想在注册/个人资料页面上选择多个组,那就有点复杂,但仍然不太困难。您必须向表单添加复选框或多选,并且在提交表单时,控制器中有一些逻辑可以根据所选的成员资格处理对 db.auth_membership 的插入。
I don't think there's anything standard built in for this, but you could easily build your own using Crud, or even more easily with SQLFORM.grid / SQLFORM.smartgrid. For example:
or
If you want to select multiple groups on a registration/profile page, that's a little more complicated, but still not too difficult. You'd have to add checkboxes or a multiselect to the form, and when the form is submitted, have some logic in the controller that handles the inserts into db.auth_membership based on the memberships selected.