def edit(self, id): c.travel = Travel.find_by_id(id) defaults = h.object_to_defaults(c.travel, "travel") form = render("/travel/edit.mako") return htmlfill.render(form, defaults)
def _delete(self, id): c.travel = Travel.find_by_id(id) meta.Session.delete(c.travel) meta.Session.commit() h.flash("Travel has been deleted.") redirect_to('index')
def _delete(self, id): c.travel = Travel.find_by_id(id) meta.Session.delete(c.travel) meta.Session.commit() h.flash("Travel has been deleted.") redirect_to("index")
def edit(self, id): c.travel = Travel.find_by_id(id) defaults = h.object_to_defaults(c.travel, 'travel') form = render('/travel/edit.mako') return htmlfill.render(form, defaults)
def delete(self, id): """Delete the travel GET will return a form asking for approval. POST requests will delete the item. """ c.travel = Travel.find_by_id(id) return render("/travel/confirm_delete.mako")
def _new(self): results = self.form_result['travel'] c.travel = Travel(**results) meta.Session.add(c.travel) meta.Session.commit() h.flash("Travel created") redirect_to(action='index', id=None)
def delete(self, id): """Delete the travel GET will return a form asking for approval. POST requests will delete the item. """ c.travel = Travel.find_by_id(id) return render('/travel/confirm_delete.mako')
def _edit(self, id): travel = Travel.find_by_id(id) for key in self.form_result["travel"]: setattr(travel, key, self.form_result["travel"][key]) # update the objects with the validated form data meta.Session.commit() h.flash("The Travel has been updated successfully.") redirect_to(action="index", id=None)
def _edit(self, id): travel = Travel.find_by_id(id) for key in self.form_result['travel']: setattr(travel, key, self.form_result['travel'][key]) # update the objects with the validated form data meta.Session.commit() h.flash("The Travel has been updated successfully.") redirect_to(action='index', id=None)
def _new(self): results = self.form_result['travel'] # TODO: This doesn't make sense, Travel controller is restricted to admins # But new template refers to each person updating their details c.travel = Travel(**results) c.travel.person = h.signed_in_person() meta.Session.add(c.travel) meta.Session.commit() h.flash("Travel created") redirect_to(action='index', id=None)
def index(self): c.travel_collection = Travel.find_all() return render("/travel/list.mako")
def view(self, id): c.travel = Travel.find_by_id(id) return render("/travel/view.mako")
def index(self): c.travel_collection = Travel.find_all() return render('/travel/list.mako')
def view(self, id): c.travel = Travel.find_by_id(id) return render('/travel/view.mako')