开发者

Selecting a row from HTML table and edit/delete it

I have created a html table (using TG2.1 with mako) for a file from MySQL db. Now I would like to provide for "Edit / Delete" a particul开发者_运维技巧ar row (record), by selecting that row in table.

Note that I am not using SQLAlchemy, since I am more comfortable with SQL query-generation myself. I am directly using MySQLdb and executing queries, fetching resultset, etc.

I checked the docs of TG 2.1, which shows how to edit a Wiki Page by using Sprox library. But I do not have a data-model, so I think I can't use Sprox.

Is there any other way to "identify the row selected by user" and "give an interface for editing it"


So, when I'm outputting the table row in my template code I would also output a link to edit, and a link (or button!) to delete the object, specifying the ID in the url string.

Creating a URL that looks like

/things/edit/2

for record id 2.

Then create an edit method in your controller. It will take two parameters: the first being self (of course), and the second being the ID you passed up above (2, in this case).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜