Beispiel #1
0
class Variantoptions(Base):
    __category__ = 'Product'

    available_for_sale = db.Column(db.Boolean, default=False)
    currently_not_in_stock = db.Column(db.Boolean)
    requires_shipping = db.Column(db.Boolean)
    quantity_available = db.Column(db.Integer)
    compare_at_price = db.Column(db.Float)
    unit_price = db.Column(db.Float)
    weight = db.Column(db.Float)
    price = db.Column(db.Float)
    namespace = db.Column(db.String)
    title = db.Column(db.String)
    sku = db.Column(db.String)
    key = db.Column(db.String)
    selected_options = db.relationship('Option',
                                       secondary=variants_options_relation,
                                       backref=db.backref('variantoptions',
                                                          lazy='dynamic'))
    images = db.relationship('Image',
                             secondary=images_options_relation,
                             backref=db.backref('variantoptions',
                                                lazy='dynamic'))
    metafield = db.relationship('Metafield',
                                backref='variant_options',
                                lazy=True,
                                uselist=True)
    product = db.Column(db.Integer, db.ForeignKey('product.id'))
Beispiel #2
0
class Product(Base, DateTimeMixin):
    __category__ = 'Product'

    sku = db.Column(db.String(255), nullable=False)
    title = db.Column(db.String)
    key = db.Column(db.String(30))  # required
    product_type = db.Column(db.String)
    description = db.Column(db.String)
    handle = db.Column(
        db.String
    )  # auto generate from title . like Black Shirt --> Black-Shirt
    descriptionHtml = db.Column(db.String)
    vendor = db.Column(db.String)
    namespace = db.Column(db.String(20), nullable=False)
    taxable = db.Column(db.Boolean(), default=False)
    available_for_sale = db.Column(db.Boolean(), default=False)
    total_inventory = db.Column(db.Integer, nullable=False)
    created_at = db.Column(db.DateTime(), default=db.func.now())
    updated_at = db.Column(db.DateTime(),
                           onupdate=db.func.now(),
                           default=db.func.now())
    metafields = db.relationship('Metafield', backref='prod', uselist=True)
    price_range = db.relationship('Pricerange',
                                  backref='pricerange',
                                  uselist=True)
    options = db.relationship('Option',
                              secondary=options_products_relation,
                              backref=db.backref('products', lazy='dynamic'))
    tags = db.relationship('Tag',
                           secondary=tags_products_relation,
                           backref=db.backref('products', lazy='dynamic'))
    selected_options = db.relationship(
        'Selectedinput',
        secondary=selected_options_products_relation,
        backref=db.backref('products', lazy='dynamic'))
    variant_by_selected_options = db.relationship(
        'Variantoptions',
        lazy=True,
        uselist=True,
        backref=db.backref('products', uselist=True))

    @classmethod
    def get_by_sku(cls, sku):
        return cls.query.filter_by(sku=sku).first()
Beispiel #3
0
class Domain(Base):
    __category__ = 'Shop'

    host = db.Column(db.String)
    ssl_enabled = db.Column(db.Boolean)
    url = db.Column(db.String)
    shops = db.relationship('Shop',
                            lazy=True,
                            uselist=True,
                            backref=db.backref('domain', uselist=True))
Beispiel #4
0
class Service(Policy):
    shop = db.relationship('Shop',
                           lazy=True,
                           uselist=True,
                           backref=db.backref('terms_of_service',
                                              uselist=False))
Beispiel #5
0
class Refund(Policy):
    shop = db.relationship('Shop',
                           lazy=True,
                           uselist=True,
                           backref=db.backref('refund_policy', uselist=False))
Beispiel #6
0
class Privacy(Policy):
    shop = db.relationship('Shop',
                           lazy=True,
                           uselist=True,
                           backref=db.backref('privacy_policy', uselist=False))