def delete(self, id): """Delete the voucher GET will return a form asking for approval. POST requests will delete the item. """ c.voucher = Voucher.find_by_id(id) return render('/voucher/confirm_delete.mako')
def _delete(self, id): c.voucher = Voucher.find_by_id(id) if not c.voucher.registration: meta.Session.delete(c.voucher) meta.Session.commit() h.flash("Voucher has been deleted.") else: h.flash("Cannot delete a voucher which has already been used.", 'error') redirect_to('index')