Beispiel #1
0
class ProductImage(db.Model):
    __tablename__ = "productimages"
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(512), nullable=False)
    description = db.Column(db.Text)
    image = db.Column(db.String(512))
    position = db.Column(db.Integer)
Beispiel #2
0
class Product(db.Model):
    __tablename__ = 'products'

    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(512), nullable=False)
    description = db.Column(db.Text)
    image = db.Column(db.String(512))

    def __repr__(self):
        return '<Product {!r}>'.format(self.title)
Beispiel #3
0
class ProductVariant(db.Model):
    __tablename__ = "productvariants"
    
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(512), nullable=False)
    description = db.Column(db.Text)
    sku = db.Column(db.String(512))
    price = db.Column(db.Integer)
    inventory = db.Column(db.Integer)

    mainproduct_id = db.Column(db.Integer, db.ForeignKey('products.id'))
    mainproduct = db.relationship("Product", backref=db.backref('variants', order_by=id))

    def __repr__(self):
        return '<ProductVariant {!r}>'.format(self.title)
Beispiel #4
0
class Order(db.Model):
    __tablename__ = 'orders'
    TYPES = [(10,'Cart'),
             (20,'Checkout'),
             (30,'Confirmed'),
             (40,'Paid'),
             (50,'Completed')]
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(512), nullable=False)
    ordertype = db.Column(db.Integer)
Beispiel #5
0
class OrderLine(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    order_id = db.Column(db.Integer, db.ForeignKey('orders.id'))
    order = db.relationship("Order", backref=db.backref('orderlines', order_by=id)) 
        
    productvariant_id = db.Column(db.Integer, db.ForeignKey('productvariants.id'),nullable=True)
    productvariant =  db.relationship("ProductVariant")
        
    quantity = db.Column(db.Integer)
    unit_price = db.Column(db.Integer)    
    extradata = db.Column(db.String(1024), nullable=False)
                         
class CartLine(db.Model):
    __tablename__ = 'cartlines'

    id = db.Column(db.Integer, primary_key=True)
    productvariant_id = db.Column(db.Integer,
                                  db.ForeignKey('productvariants.id'))
    productvariant = db.relationship("ProductVariant")

    quantity = db.Column(db.Integer)
    data = db.Column(db.String(2048), nullable=False)

    cart_id = db.Column(db.Integer, db.ForeignKey('carts.id'))
    cart = db.relationship("Cart",
                           backref=db.backref('cartlines', order_by=id))
class Cart(db.Model):
    __tablename__ = 'carts'

    id = db.Column(db.Integer, primary_key=True)
    token = db.Column(db.String(128))
Beispiel #8
0
class Order(db.Model):
    __tablename__ = 'orders'
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(512), nullable=False)