http://webpy.org/cookbook/forms

i've been looking at all the form examples on webpy.org - it shows how
to make them, but not how to update/edit data or delete.

here's the last example i followed - how would i edit the form?

  1 import web
  2
  3 render = web.template.render('templates/')
  4
  5 urls = (
  6     '/', 'index',
  7     '/add', 'add',
  8     '/edit', 'edit'
  9         )
 10
 11 app = web.application(urls, globals())
 12
 13 db = web.database(dbn='mysql', user='root', pw='', db='karmic')
 14
 15 class index:
 16
 17     def GET(self):
 18         todos = db.select('todo')
 19         return render.index(todos)
 20
 21 class add:
 22     def POST(self):
 23         i = web.input()
 24         n = db.insert('todo', title=i.title)
 25         raise web.seeother('/')
 26
 27 class edit:
 28     def POST(self):
 29         i = web.input()
 30         n - db.update('todo', title=i.title)
 31         raise web.seeother('/')
 32
 33 if __name__ == "__main__": app.run()


it doesn't throw an error but it doesn't work either... any clues/help
appreciated

(i come from a php background - in my mind i would normally just query
and set the values of the fields to the item to be edited, then on
post just update items where... [mention this in case it helps shape
any responses])
tia,
greg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to