Add MemberBarcode to op model

This commit is contained in:
Lance Edgar 2021-01-13 19:18:17 -06:00
parent 19d62b535f
commit d398e706c4

View file

@ -1179,6 +1179,21 @@ class MemberInfo(Base):
Reference to the member to whom the date record applies.
"""))
barcodes = orm.relationship(
'MemberBarcode',
primaryjoin='MemberBarcode.card_number == MemberInfo.card_number',
foreign_keys='MemberBarcode.card_number',
order_by='MemberBarcode.upc',
# cascade='all, delete-orphan',
doc="""
List of extra barcode records for the member.
""",
backref=orm.backref(
'member_info',
doc="""
Reference to the :class:`MemberInfo` record to which the barcode applies.
"""))
notes = orm.relationship(
'MemberNote',
primaryjoin='MemberNote.card_number == MemberInfo.card_number',
@ -1284,6 +1299,21 @@ class MemberContact(Base):
return str(self.preference)
class MemberBarcode(Base):
"""
Additional barcode for a member.
"""
__tablename__ = 'memberCards'
card_number = sa.Column('card_no', sa.Integer(), nullable=False,
primary_key=True, autoincrement=False)
upc = sa.Column(sa.String(length=13), nullable=False, primary_key=True)
def __str__(self):
return self.upc or ""
class MemberNote(Base):
"""
Additional notes for a member.