Changeset 409cbc2 in rattail


Ignore:
Timestamp:
08/02/2020 07:10:10 PM (3 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
0590399
Parents:
42d20a7
git-author:
Lance Edgar <lance@…> (08/02/2020 07:09:34 PM)
git-committer:
Lance Edgar <lance@…> (08/02/2020 07:10:10 PM)
Message:

Add first_email(), first_phone() etc. for ContactMixin?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/db/model/contact.py

    r42d20a7 r409cbc2  
    148148    _contact_phone_model = None
    149149    _contact_address_model = None
     150
     151    def first_email(self, **kwargs):
     152        """
     153        Return the first available email record for the contact.
     154        """
     155        if self.emails:
     156            return self.emails[0]
    150157
    151158    def make_email(self, **kwargs):
     
    199206            session.flush()
    200207
     208    def first_phone(self, **kwargs):
     209        """
     210        Return the first available phone record for the contact.
     211        """
     212        if self.phones:
     213            return self.phones[0]
     214
    201215    def make_phone(self, **kwargs):
    202216        """
     
    251265                session.flush()
    252266
     267    def first_address(self, **kwargs):
     268        """
     269        Return the first available address record for the contact.
     270        """
     271        if self.addresses:
     272            return self.addresses[0]
     273
    253274    def make_address(self, **kwargs):
    254275        """
Note: See TracChangeset for help on using the changeset viewer.