How to use the tblib.model.session function in tblib

To help you get started, we’ve selected a few tblib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shiyanlou / louplus-python / taobei / tbuser / handlers / user.py View on Github external
def create_user():
    """注册用户
    """

    data = request.get_json()
    password = data.pop('password')

    user = UserSchema().load(data)
    user.password = password
    session.add(user)
    session.commit()

    return json_response(user=UserSchema().dump(user))
github shiyanlou / louplus-python / taobei / tbmall / handlers / shop.py View on Github external
def create_shop():
    """创建店铺
    """

    data = request.get_json()

    shop = ShopSchema().load(data)
    session.add(shop)
    session.commit()

    return json_response(shop=ShopSchema().dump(shop))
github shiyanlou / louplus-python / taobei / tbuser / handlers / address.py View on Github external
def create_address():
    """添加地址
    """

    data = request.get_json()

    address = AddressSchema().load(data)
    session.add(address)
    session.commit()

    return json_response(address=AddressSchema().dump(address))
github shiyanlou / louplus-python / taobei / tbuser / handlers / user.py View on Github external
def create_user():
    """注册用户
    """

    data = request.get_json()
    password = data.pop('password')

    user = UserSchema().load(data)
    user.password = password
    session.add(user)
    session.commit()

    return json_response(user=UserSchema().dump(user))
github shiyanlou / louplus-python / taobei / tbbuy / handlers / order.py View on Github external
def create_order():
    """创建订单,订单商品需要一起提交
    """

    data = request.get_json()
    if data.get('pay_amount') is None:
        data['pay_amount'] = sum([x['price'] * x['amount']
                                  for x in data['order_products']])

    order = OrderSchema().load(data)
    session.add(order)
    session.commit()

    return json_response(order=OrderSchema().dump(order))
github shiyanlou / louplus-python / taobei / tbmall / handlers / product.py View on Github external
def create_product():
    """创建商品
    """

    data = request.get_json()

    product = ProductSchema().load(data)
    session.add(product)
    session.commit()

    return json_response(product=ProductSchema().dump(product))
github shiyanlou / louplus-python / taobei / tbmall / handlers / shop.py View on Github external
def create_shop():
    """创建店铺
    """

    data = request.get_json()

    shop = ShopSchema().load(data)
    session.add(shop)
    session.commit()

    return json_response(shop=ShopSchema().dump(shop))