Cleanup attribute names for Department model

This commit is contained in:
Lance Edgar 2019-07-23 19:44:11 -05:00
parent 4cbdcc6870
commit 9f19646f08

View file

@ -43,34 +43,35 @@ class Department(Base):
""" """
__tablename__ = 'departments' __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) dept_see_id = sa.Column(sa.Boolean(), nullable=True)
modified = sa.Column(sa.DateTime(), 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) 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): def __str__(self):
return self.dept_name or '' return self.name or ''
@six.python_2_unicode_compatible @six.python_2_unicode_compatible
@ -256,7 +257,7 @@ class Product(Base):
department = orm.relationship( department = orm.relationship(
Department, Department,
primaryjoin=Department.dept_no == dept_no, primaryjoin=Department.number == dept_no,
foreign_keys=[dept_no], foreign_keys=[dept_no],
doc=""" doc="""
Reference to the :class:`Department` to which the product belongs. Reference to the :class:`Department` to which the product belongs.