def _delete(self, id): c.funding_type = FundingType.find_by_id(id) meta.Session.delete(c.funding_type) meta.Session.commit() h.flash("Funding type has been deleted.") redirect_to('index')
def edit(self, id): c.funding_type = FundingType.find_by_id(id) defaults = h.object_to_defaults(c.funding_type, 'funding_type') form = render('/funding_type/edit.mako') return htmlfill.render(form, defaults)
def delete(self, id): """Delete the funding type GET will return a form asking for approval. POST requests will delete the item. """ c.funding_type = FundingType.find_by_id(id) return render('/funding_type/confirm_delete.mako')
def _edit(self, id): funding_type = FundingType.find_by_id(id) for key in self.form_result['funding_type']: setattr(funding_type, key, self.form_result['funding_type'][key]) # update the objects with the validated form data meta.Session.commit() h.flash("Funding type has been updated successfully.") redirect_to(action='view', id=id)
def _to_python(self, value, state): funding_type = FundingType.find_by_id(int(value)) if funding_type != None and funding_type.available(): return funding_type else: return False
def view(self, id): c.funding_type = FundingType.find_by_id(id) return render('/funding_type/view.mako')