From 9f19646f0856462f602f7e84f1b0e1c080afd4ae Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 23 Jul 2019 19:44:11 -0500 Subject: [PATCH] Cleanup attribute names for Department model --- corepos/db/model.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/corepos/db/model.py b/corepos/db/model.py index 67ac097..c79d2de 100644 --- a/corepos/db/model.py +++ b/corepos/db/model.py @@ -43,34 +43,35 @@ class Department(Base): """ __tablename__ = 'departments' - dept_no = sa.Column(sa.SmallInteger(), primary_key=True, autoincrement=False, nullable=False) + number = sa.Column('dept_no', sa.SmallInteger(), primary_key=True, autoincrement=False, nullable=False) - dept_name = sa.Column(sa.String(length=30), nullable=True) + name = sa.Column('dept_name', sa.String(length=30), nullable=True) - dept_tax = sa.Column(sa.Boolean(), nullable=True) + tax = sa.Column(sa.Boolean(), nullable=True) - dept_fs = sa.Column(sa.Boolean(), nullable=True) + food_stampable = sa.Column('dept_fs', sa.Boolean(), nullable=True) - dept_limit = sa.Column(sa.Float(), nullable=True) + limit = sa.Column('dept_limit', sa.Float(), nullable=True) - dept_minimum = sa.Column(sa.Float(), nullable=True) + minimum = sa.Column('dept_minimum', sa.Float(), nullable=True) - dept_discount = sa.Column(sa.Boolean(), nullable=True) + discount = sa.Column('dept_discount', sa.Boolean(), nullable=True) + # TODO: probably should rename this attribute, but to what? dept_see_id = sa.Column(sa.Boolean(), nullable=True) modified = sa.Column(sa.DateTime(), nullable=True) - modifiedby = sa.Column(sa.Integer(), nullable=True) + modified_by_id = sa.Column('modifiedby', sa.Integer(), nullable=True) margin = sa.Column(sa.Float(), nullable=False, default=0) - salesCode = sa.Column(sa.Integer(), nullable=False, default=0) + sales_code = sa.Column('salesCode', sa.Integer(), nullable=False, default=0) - memberOnly = sa.Column(sa.SmallInteger(), nullable=False, default=0) + member_only = sa.Column('memberOnly', sa.SmallInteger(), nullable=False, default=0) def __str__(self): - return self.dept_name or '' + return self.name or '' @six.python_2_unicode_compatible @@ -256,7 +257,7 @@ class Product(Base): department = orm.relationship( Department, - primaryjoin=Department.dept_no == dept_no, + primaryjoin=Department.number == dept_no, foreign_keys=[dept_no], doc=""" Reference to the :class:`Department` to which the product belongs.