向 trac AccountManager 插件添加新列
我想向 trac AccountManager
插件添加新列,我已经编辑了 admin_user.html,但是在 python 中我必须编辑哪些文件。我想再添加两个数据字段。例如:群组和电话,我该怎么做?
更新
这是我在admin_user.html中添加的两个字段
<div class="field">
<label>Telephone:<br />
<input type="text" name="tel" class="textwidget"
value="${account.tel}" /></label>
</div>
<div class="field">
<label>Group:<br />
<input type="text" name="group" class="textwidget"
value="${account.group}" /></label>
</div>
,我还将这两列添加到表中:
<td>${acct.group}</td>
<td>${acct.last_visit}</td>
但是我不熟悉python,所以我不知道如何添加python代码中的功能
I want to add new columns to the trac AccountManager
plugin, I already edited the admin_user.html, but in python what do I have to edit, which files. I want to add two more data field. ex: group and telephone, How can I do that?
UPDATED
This is the two field I added in the admin_user.html
<div class="field">
<label>Telephone:<br />
<input type="text" name="tel" class="textwidget"
value="${account.tel}" /></label>
</div>
<div class="field">
<label>Group:<br />
<input type="text" name="group" class="textwidget"
value="${account.group}" /></label>
</div>
and I also added the two column to the table:
<td>${acct.group}</td>
<td>${acct.last_visit}</td>
But I'm not familiar with python, so I don't know how can I add the functionality in the python code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否检查过 UserManagerPlugin 是否能够添加任意新列?
但也许您希望在用户管理页面的通用视图中添加一些内容,对吗?当然,如果您关心通用性,那么这些必须是可选的。
在“admin.py”中,您将看到一个类“AccountManagerAdminPages”,其中包含一个模块“_do_users”。该模块是与相关管理页面相关的所有请求的主要处理程序。虽然开始是关于处理“POST”(用户输入),但“iflisting_enabled:”行之后的所有内容都将准备接下来显示的页面。您将看到各种来源,但主要来源是对 Trac 数据库表“session_attribute”的查询。
我再次希望您看一下 UserManagerPlugin - 所有您可能想要的以及更多。
披露:我是 AccountManagerPlugin 的当前维护者。
Did you check UserManagerPlugin for it's ability to add arbitrary new columns?
But maybe you want it some additions to the generic view in users admin page, right? These must be optional, if you care for universal use, of course.
In 'admin.py' you'll see a Class 'AccountManagerAdminPages' with a module '_do_users'. This module is primary handler for all requests related to the admin page in question. While the beginning is about processing 'POST' (user input) everything after the line 'if listing_enabled:' will prepare the page displayed next. You'll see various sources, but main source is query to Trac db table 'session_attribute'.
Again I'd like you to take a look at UserManagerPlugin - all what you may want and more.
Disclosure: I'm the current maintainer of AccountManagerPlugin.