Question

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 particular 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"

No correct solution

OTHER TIPS

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top