Ejemplo n.º 1
0
 def get(self, request, tablename=None, rowid=None):
     klass = get_model(tablename)
     dbrow = webhelpers.get_row(klass, rowid)
     title = "Edit %s %s" % (tablename, dbrow)
     resp = self.get_response(request, title=title)
     resp.new_para(title)
     form = resp.add_form(action=request.get_url(edit, tablename=tablename, rowid=rowid))
     webhelpers.build_edit_form(form, klass, dbrow)
     return resp.finalize()
Ejemplo n.º 2
0
 def post(self, request, tablename=None, rowid=None):
     klass = get_model(tablename)
     dbrow = webhelpers.get_row(klass, rowid)
     try:
         webhelpers.update_row(request.POST, klass, dbrow)
     except types.ValidationError, err:
         webhelpers.dbsession.rollback()
         title = "Re-edit %s %s" % (tablename, dbrow)
         resp = self.get_response(request, title=title)
         resp.new_para(title)
         form = resp.add_form(action=request.get_url(edit, tablename=tablename, rowid=rowid))
         webhelpers.build_edit_form(form, klass, dbrow, err)
         return resp.finalize()