Add initial Shopfoo pattern feature
data models, import/export, web views etc.
This commit is contained in:
parent
a7656928f5
commit
852f9d4902
19 changed files with 515 additions and 1 deletions
13
rattail_demo/db/model/__init__.py
Normal file
13
rattail_demo/db/model/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Rattail Demo data model
|
||||
"""
|
||||
|
||||
# bring in all the normal stuff from Rattail
|
||||
from rattail.db.model import *
|
||||
|
||||
# also bring in CORE integration models
|
||||
from rattail_corepos.db.model import *
|
||||
|
||||
# now bring in Demo-specific models
|
||||
from .shopfoo import ShopfooProduct, ShopfooProductExport
|
37
rattail_demo/db/model/shopfoo.py
Normal file
37
rattail_demo/db/model/shopfoo.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Database schema extensions for Shopfoo integration
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from rattail.db import model
|
||||
from rattail.db.model.shopfoo import ShopfooProductBase, ShopfooProductExportBase
|
||||
|
||||
|
||||
class ShopfooProduct(ShopfooProductBase, model.Base):
|
||||
"""
|
||||
Shopfoo-specific product cache table. Each record in this table *should*
|
||||
match exactly, what is in the actual "Shopfoo" system (even though that's
|
||||
made-up in this case).
|
||||
"""
|
||||
__tablename__ = 'demo_shopfoo_product'
|
||||
__versioned__ = {}
|
||||
|
||||
upc = sa.Column(sa.String(length=14), nullable=True)
|
||||
|
||||
description = sa.Column(sa.String(length=255), nullable=True)
|
||||
|
||||
price = sa.Column(sa.Numeric(precision=13, scale=2), nullable=True)
|
||||
|
||||
enabled = sa.Column(sa.Boolean(), nullable=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.description or self.upc or ""
|
||||
|
||||
|
||||
class ShopfooProductExport(ShopfooProductExportBase, model.Base):
|
||||
"""
|
||||
Shopfoo product exports
|
||||
"""
|
||||
__tablename__ = 'demo_shopfoo_product_export'
|
Loading…
Add table
Add a link
Reference in a new issue