Changeset 07291b3 in pycorepos


Ignore:
Timestamp:
07/13/20 11:02:59 (5 weeks ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
68ab8ff
Parents:
beb73dc
Message:

Add MemberNote and MemberInfo.notes to data model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • corepos/db/office_op/model.py

    rbeb73dc r07291b3  
    10251025            """))
    10261026
     1027    notes = orm.relationship(
     1028        'MemberNote',
     1029        primaryjoin='MemberNote.card_number == MemberInfo.card_number',
     1030        foreign_keys='MemberNote.card_number',
     1031        order_by='MemberNote.timestamp',
     1032        cascade='all, delete-orphan',
     1033        doc="""
     1034        List of note records for the member.
     1035        """,
     1036        backref=orm.backref(
     1037            'member_info',
     1038            doc="""
     1039            Reference to the :class:`MemberInfo` record to which the note applies.
     1040            """))
     1041
    10271042    @property
    10281043    def full_name(self):
     
    10801095
    10811096
     1097class MemberNote(Base):
     1098    """
     1099    Additional notes for a member.
     1100    """
     1101    __tablename__ = 'memberNotes'
     1102
     1103    id = sa.Column('memberNoteID', sa.Integer(), nullable=False, primary_key=True, autoincrement=True)
     1104
     1105    card_number = sa.Column('cardno', sa.Integer(), nullable=True)
     1106
     1107    note = sa.Column(sa.Text(), nullable=True)
     1108
     1109    timestamp = sa.Column('stamp', sa.DateTime(), nullable=True)
     1110
     1111    username = sa.Column(sa.String(length=50), nullable=True)
     1112
     1113    def __str__(self):
     1114        return self.note or ""
     1115
     1116
    10821117class HouseCoupon(Base):
    10831118    """
Note: See TracChangeset for help on using the changeset viewer.