Example #1
0
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)
Example #2
0
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={})
Example #3
0
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)
Example #4
0
 def get(self):
     return get_model().readall()
Example #5
0
 def get(self, orderno):
     return get_model().find_by_orderno(orderno)
Example #6
0
def delete(id):
    get_model().delete(id)
    return redirect(url_for('.list'))
Example #7
0
def view(id):
    order = get_model().read(id)
    return render_template("view.html", order=order)
Example #8
0
 def get(self, gcno):
     return get_model().find_by_gcno(gcno)