diff --git a/corepos/db/office_op/model.py b/corepos/db/office_op/model.py index f38f75a..ba24d7d 100644 --- a/corepos/db/office_op/model.py +++ b/corepos/db/office_op/model.py @@ -390,7 +390,7 @@ class MemberType(Base): return self.description or "" -class Customer(Base): +class CustData(Base): """ Represents a customer of the organization. """ @@ -451,7 +451,7 @@ class Customer(Base): member_info = orm.relationship( 'MemberInfo', - primaryjoin='MemberInfo.card_number == Customer.card_number', + primaryjoin='MemberInfo.card_number == CustData.card_number', foreign_keys=[card_number], uselist=False, back_populates='customers', @@ -463,6 +463,10 @@ class Customer(Base): return "{} {}".format(self.first_name or '', self.last_name or '').strip() +# TODO: deprecate / remove this (so we can repurpose, for 'Customers' table) +Customer = CustData + + class MemberInfo(Base): """ Contact info regarding a member of the organization. @@ -496,13 +500,13 @@ class MemberInfo(Base): ads_ok = sa.Column('ads_OK', sa.Boolean(), nullable=True, default=True) customers = orm.relationship( - Customer, - primaryjoin=Customer.card_number == card_number, - foreign_keys=[Customer.card_number], + CustData, + primaryjoin=CustData.card_number == card_number, + foreign_keys=[CustData.card_number], back_populates='member_info', - remote_side=Customer.card_number, + remote_side=CustData.card_number, doc=""" - List of :class:`Customer` instances which are associated with this member info. + List of :class:`CustData` instances which are associated with this member info. """) dates = orm.relationship(