Rename attributes for MemberType data model
also, comment-out the "sales code" column for now, since it doesn't exist in all production databases. (not sure how best to handle that yet)
This commit is contained in:
parent
08a062f654
commit
d2e764f388
|
@ -332,11 +332,11 @@ class MemberType(Base):
|
||||||
"""
|
"""
|
||||||
__tablename__ = 'memtype'
|
__tablename__ = 'memtype'
|
||||||
|
|
||||||
memtype = sa.Column(sa.SmallInteger(), primary_key=True, nullable=False, default=0)
|
id = sa.Column('memtype', sa.SmallInteger(), primary_key=True, nullable=False, default=0)
|
||||||
|
|
||||||
memDesc = sa.Column(sa.String(length=20), nullable=True)
|
description = sa.Column('memDesc', sa.String(length=20), nullable=True)
|
||||||
|
|
||||||
custdataType = sa.Column(sa.String(length=10), nullable=True)
|
customer_type = sa.Column('custdataType', sa.String(length=10), nullable=True)
|
||||||
|
|
||||||
discount = sa.Column(sa.SmallInteger(), nullable=True)
|
discount = sa.Column(sa.SmallInteger(), nullable=True)
|
||||||
|
|
||||||
|
@ -344,10 +344,12 @@ class MemberType(Base):
|
||||||
|
|
||||||
ssi = sa.Column(sa.Boolean(), nullable=True)
|
ssi = sa.Column(sa.Boolean(), nullable=True)
|
||||||
|
|
||||||
salesCode = sa.Column(sa.Integer(), nullable=True)
|
# TODO: this was apparently added "recently" - isn't present in all DBs
|
||||||
|
# (need to figure out how to conditionally include it in model?)
|
||||||
|
# sales_code = sa.Column('salesCode', sa.Integer(), nullable=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.memDesc or ""
|
return self.description or ""
|
||||||
|
|
||||||
|
|
||||||
class Customer(Base):
|
class Customer(Base):
|
||||||
|
@ -404,7 +406,7 @@ class Customer(Base):
|
||||||
|
|
||||||
member_type = orm.relationship(
|
member_type = orm.relationship(
|
||||||
MemberType,
|
MemberType,
|
||||||
primaryjoin=MemberType.memtype == memType,
|
primaryjoin=MemberType.id == memType,
|
||||||
foreign_keys=[memType],
|
foreign_keys=[memType],
|
||||||
doc="""
|
doc="""
|
||||||
Reference to the :class:`MemberType` to which this member belongs.
|
Reference to the :class:`MemberType` to which this member belongs.
|
||||||
|
|
Loading…
Reference in a new issue