def updelement(componentid=None): option = 'component' form = setform(option, request.form, modify=True) tmcomponent = ComponentObject(session, Components) if request.method == 'POST': # Update the component flash(tmcomponent.update(componentid, request.form)) (option, pagetitle, form, deleteoptions, addfeatureoptions, categoriesopt, updateoption) = populatelist(option) return render_template('maintstatic.html', statictitle=pagetitle, form=form, numrows=len(form), option=option, deleteoption=deleteoptions, featureoption=addfeatureoptions, categoryoption=categoriesopt, updateoption=updateoption) else: # form = setform(option, None, modify=True) compdata = tmcomponent.getdatabyid(componentid) form = tmcomponent.loadform(compdata, False) if option == 'component': # Add suppliers choices form.supplier.choices = [(a.ID, a.Name) for a in session.query(Suppliers).order_by('Name')] # Add location choices form.location.choices = \ [(a.ID, a.Name+'::'+a.Sublocation) for a in session.query(Locations).order_by('Name')] return render_template('updatecomponent.html', form=form, statictitle=option, componentid=componentid)