Esempio n. 1
0
def addproduct():
    res = request.form.to_dict()
    p = Product(**res)
    if p.save():
        flash("添加成功")
    else:
        flash("添加失败")
    return redirect(url_for("productadd"))
Esempio n. 2
0
def search():
    a = request.form
    l = Product(**a)
    res = l.search()
    names = l.colnames()
    if res == []:
        flash('没有查到结果')
    res.insert(0, names)
    return render_template('search01.html', formdata=names, listdata=res)
Esempio n. 3
0
def getform():
    a = request.form
    l = Product(**a)
    print(l.info)
    if l.save():
        flash("提交成功")
    else:
        flash("提交失败")
    return redirect(url_for("form01"))
Esempio n. 4
0
def test01(page):

    print(page)
    p = Product.fetchall()
    print(p)
    b = buffer(*p)
    print(b)
    b.send(None)
    return str(b.send(page))
Esempio n. 5
0
            n = (i + 1) * BUFFERSIZE
        elif p == 'last':
            i = i - 1
            m = i * BUFFERSIZE
            n = (i + 1) * BUFFERSIZE
        elif isinstance(p, int):
            i = p - 1
            m = i * BUFFERSIZE
            n = (i + 1) * BUFFERSIZE
        else:
            pass


def getbuf(message, f):
    try:
        val = f.send(message)
    except:
        f.send(None)
        val = f.send(message)
    finally:
        return val


if __name__ == '__main__':
    from func import Product
    l = Product.fetchall()
    b = buffer(*l)
    print(getbuf(1, b))
    print(getbuf('next', b))
    print(getbuf('next', b))
Esempio n. 6
0
def list01():
    res = Product.fetchall(10)
    res.insert(0, Product.colnames())
    return render_template('list01.html', data=res)
Esempio n. 7
0
def search01():
    names = Product.colnames()
    return render_template('search01.html', formdata=names)
Esempio n. 8
0
def form01():
    res = Product.colnames()
    return render_template('form01.html', data=res)
Esempio n. 9
0
def test():
    p = Product.fetchall__lazy(2)
    t = p.send(None)
    return str(t)