From 3fbd5a7121151103d00862dafc4a8b1fb6cef1a5 Mon Sep 17 00:00:00 2001 From: David Rasch Date: Mon, 6 Jul 2015 21:05:52 +0200 Subject: [PATCH] add product variant --- .gitignore | 3 ++- rfs/products/models.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b2203e3..0e41d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -59,4 +59,5 @@ target/ # project specific app/static/libs/* .module-cache/ -node_modules/ \ No newline at end of file +node_modules/ +test.db \ No newline at end of file diff --git a/rfs/products/models.py b/rfs/products/models.py index 6174437..60cd372 100644 --- a/rfs/products/models.py +++ b/rfs/products/models.py @@ -5,3 +5,15 @@ class Product(db.Model): 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)) + +class ProductVariant(db.model) + 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(Integer, ForeignKey('products.id')) + mainproduct = relationship("Product", backref=backref('varients', order_by=id))