Пример #1
0
def create_order():
    if not request.json:
        abort(400)
    order = Orders(request.json['name'], request.json['cellphone'],
                   request.json['address'], request.json['description'], request.json['status'])

    session.add(order)
    session.commit()
    return jsonify({}), 201
Пример #2
0
def add_order_to_db(cookie_id,quantity):
    print("checking...")
    add_order_session = Session()
    order = Orders(cookie_id=cookie_id, order_quantity=quantity)
    add_order_session.add(order)

    add_order_session.commit()
    print("order added successfully")
    add_order_session.close()
    return order