def edit(id): order = get_model().read(id) if request.method == 'POST': data = request.form.to_dict(flat=True) order = get_model().update(data, id) return redirect(url_for('.view', id=order['id'])) return render_template("form.html", action="Edit", order=order)
def add(): if request.method == 'POST': data = request.form.to_dict(flat=True) order = get_model().create(data) return redirect(url_for('.view', id=order['id'])) return render_template("form.html", action="Add", order={})
def list(): token = request.args.get('page_token', None) if token: token = token.encode('utf-8') orders, next_page_token = get_model().list(cursor=token) return render_template("list.html", orders=orders, next_page_token=next_page_token)
def get(self): return get_model().readall()
def get(self, orderno): return get_model().find_by_orderno(orderno)
def delete(id): get_model().delete(id) return redirect(url_for('.list'))
def view(id): order = get_model().read(id) return render_template("view.html", order=order)
def get(self, gcno): return get_model().find_by_gcno(gcno)