Ejemplo n.º 1
0
def create_data():
    from rfs.app import db
    from rfs.products.models import Product, ProductVariant
    from rfs.orders.models import Order, OrderLine

    product = Product()
    product.title = "Product 1"
    product.description = "Product 1 description"

    productvariant = ProductVariant()
    productvariant.title = "ProductVariant 1"
    productvariant.description = "ProductVariant 1 description"
    productvariant.price = 100
    productvariant.sku = "sku 1"
    productvariant.inventory = 10
    productvariant.mainproduct = product

    order = Order()
    order.id = 1
    order.ordertype = 10
    order.title = 'Shopping basket'

    orderline = OrderLine()
    orderline.productvariant = productvariant
    orderline.quantity = 1
    orderline.unit_price = 100
    orderline.extradata = "test orderline"
    orderline.order = order

    db.session.add(order)
    db.session.commit()
Ejemplo n.º 2
0
def create_data():
    from rfs.app import db
    from rfs.products.models import Product, ProductVariant
    from rfs.orders.models import Order, OrderLine

    product = Product()
    product.title = "Product 1"
    product.description = "Product 1 description"

    productvariant = ProductVariant()
    productvariant.title = "ProductVariant 1"
    productvariant.description = "ProductVariant 1 description"
    productvariant.price = 100
    productvariant.sku = "sku 1"
    productvariant.inventory = 10
    productvariant.mainproduct = product

    order = Order()
    order.id = 1
    order.ordertype = 10
    order.title = "Shopping basket"

    orderline = OrderLine()
    orderline.productvariant = productvariant
    orderline.quantity = 1
    orderline.unit_price = 100
    orderline.extradata = "test orderline"
    orderline.order = order

    db.session.add(order)
    db.session.commit()
Ejemplo n.º 3
0
def create_data():
    from rfs.app import db
    from rfs.products.models import Product, ProductVariant
    product = Product()
    product.title = "Product 1"
    product.description = "Product 1 description"

    productvariant = ProductVariant()
    productvariant.title = "ProductVariant 1"
    productvariant.description = "ProductVariant 1 description"
    productvariant.price = 100
    productvariant.sku = "sku 1"
    productvariant.inventory = 10
    productvariant.mainproduct = product

    db.session.add(product)
    db.session.add(productvariant)
    db.session.commit()
Ejemplo n.º 4
0
def create_data():
    from rfs.app import db
    from rfs.products.models import Product, ProductVariant
    product = Product()
    product.title = "Product 1"
    product.description = "Product 1 description"

    productvariant = ProductVariant()
    productvariant.title="ProductVariant 1"
    productvariant.description="ProductVariant 1 description"
    productvariant.price = 100
    productvariant.sku = "sku 1"
    productvariant.inventory= 10
    productvariant.mainproduct=product
    
    db.session.add(product)
    db.session.add(productvariant)
    db.session.commit()