def _delete(self, id): c.ceiling = Ceiling.find_by_id(id) meta.Session.delete(c.ceiling) meta.Session.commit() h.flash("Ceiling has been deleted.") redirect_to('index')
def delete(self, id): """Delete the ceiling GET will return a form asking for approval. POST requests will delete the item. """ c.ceiling = Ceiling.find_by_id(id) return render('/ceiling/confirm_delete.mako')
def _edit(self, id): ceiling = Ceiling.find_by_id(id) for key in self.form_result['ceiling']: setattr(ceiling, key, self.form_result['ceiling'][key]) # update the objects with the validated form data meta.Session.commit() h.flash("The ceiling has been updated successfully.") redirect_to(action='view', id=id)
def edit(self, id): c.ceiling = Ceiling.find_by_id(id) defaults = h.object_to_defaults(c.ceiling, 'ceiling') defaults['ceiling.products'] = [] for product in c.ceiling.products: defaults['ceiling.products'].append(product.id) if c.ceiling.available_from: defaults['ceiling.available_from'] = c.ceiling.available_from.strftime('%d/%m/%y') if c.ceiling.available_until: defaults['ceiling.available_until'] = c.ceiling.available_until.strftime('%d/%m/%y') form = render('/ceiling/edit.mako') return htmlfill.render(form, defaults)
def edit(self, id): c.ceiling = Ceiling.find_by_id(id) defaults = h.object_to_defaults(c.ceiling, 'ceiling') defaults['ceiling.products'] = [] for product in c.ceiling.products: defaults['ceiling.products'].append(product.id) if c.ceiling.available_from: defaults[ 'ceiling.available_from'] = c.ceiling.available_from.strftime( '%d/%m/%y') if c.ceiling.available_until: defaults[ 'ceiling.available_until'] = c.ceiling.available_until.strftime( '%d/%m/%y') form = render('/ceiling/edit.mako') return htmlfill.render(form, defaults)
def special_cases(self, id): c.ceiling = Ceiling.find_by_id(id) return render('/ceiling/special_cases.mako')
def view(self, id): c.ceiling = Ceiling.find_by_id(id) return render('/ceiling/view.mako')