def editsection(self, section=None, projectslug=None): # get section content using a query, then htmlfill the editsection form. # perhaps even show the current section image on top of form. id = request.params['id'] section = Section() db = section.connect('projects') contain(db, Section) results = section.view('section/getsection', key=id) result = list(iter(results)) mylist = [] for row in range(len(result)): mylist.append(result[row]['value']) values = { 'title':mylist[0][0], 'body':mylist[0][1], 'project':mylist[0][2] } c.projectlist = mylist[0][2] c.title = mylist[0][0] c.pagetitle = "Edit Section" c.imagename = mylist[0][3] c.imagelocation = mylist[0][4] c.id = mylist[0][5] return htmlfill.render(render('/admin/editsection.html'), values) @restrict('POST') @validate(schema=CreateSectionForm(), form='editsection') def savesection(self): # take edited section content and update it in couchdb. return self.form_result title = request.POST['title'] body = request.POST['body'] image = request.POST['image'] return title, " ", body, " ", image