Make sure MemberInfo.customers is sorted by person number

also improve the str() method a bit
This commit is contained in:
Lance Edgar 2020-07-30 11:11:17 -05:00
parent 4c7b208e6e
commit ef1a25f0dc

View file

@ -1017,6 +1017,7 @@ class MemberInfo(Base):
customers = orm.relationship( customers = orm.relationship(
CustData, CustData,
primaryjoin=CustData.card_number == card_number, primaryjoin=CustData.card_number == card_number,
order_by=CustData.person_number,
foreign_keys=[CustData.card_number], foreign_keys=[CustData.card_number],
back_populates='member_info', back_populates='member_info',
remote_side=CustData.card_number, remote_side=CustData.card_number,
@ -1073,7 +1074,10 @@ class MemberInfo(Base):
return '{} {}'.format(self.first_name or '', self.last_name or '').strip() return '{} {}'.format(self.first_name or '', self.last_name or '').strip()
def __str__(self): def __str__(self):
return self.full_name name = self.full_name
if name:
return name
return "Member Info #{}".format(self.card_number)
def split_street(self): def split_street(self):
""" """