def _delete(self, id): c.fulfilment_status = FulfilmentStatus.find_by_id(id) meta.Session.delete(c.fulfilment_status) meta.Session.commit() h.flash("Fulfilment Status has been deleted.") redirect_to('index', id=None)
def edit(self, id): c.fulfilment_status = FulfilmentStatus.find_by_id(id) defaults = h.object_to_defaults(c.fulfilment_status, 'fulfilment_status') defaults['fulfilment_status.types'] = [t.id for t in c.fulfilment_status.types] form = render('/fulfilment_status/edit.mako') return htmlfill.render(form, defaults)
def _new(self): results = self.form_result['fulfilment_status'] c.fulfilment_status = FulfilmentStatus(**results) meta.Session.add(c.fulfilment_status) meta.Session.commit() h.flash("Fulfilmnet Status created") redirect_to(action='index', id=None)
def delete(self, id): """Delete the fulfilment_status GET will return a form asking for approval. POST requests will delete the item. """ c.fulfilment_status = FulfilmentStatus.find_by_id(id) return render('/fulfilment_status/confirm_delete.mako')
def _edit(self, id): fulfilment_status = FulfilmentStatus.find_by_id(id) for key in self.form_result['fulfilment_status']: setattr(fulfilment_status, key, self.form_result['fulfilment_status'][key]) # update the objects with the validated form data meta.Session.commit() h.flash("The Fulfilment Status has been updated successfully.") redirect_to(action='index', id=None)
def index(self): c.fulfilment_status_collection = FulfilmentStatus.find_all() return render('/fulfilment_status/list.mako')
def view(self, id): c.fulfilment_status = FulfilmentStatus.find_by_id(id) return render('/fulfilment_status/view.mako')
def __before__(self, **kwargs): c.can_edit = True c.fulfilment_type = FulfilmentType.find_all() c.fulfilment_status = FulfilmentStatus.find_all()
def _to_python(self, value, state): value = FulfilmentStatus.find_by_id(value, abort_404=False) if value is None: raise Invalid('Status not found') else: return value