preload email_log.mailbox
This commit is contained in:
parent
272c5628bb
commit
4381314f6f
|
@ -1351,12 +1351,7 @@ class EmailLog(db.Model, ModelMixin):
|
||||||
forward = db.relationship(Contact)
|
forward = db.relationship(Contact)
|
||||||
|
|
||||||
contact = db.relationship(Contact, backref="email_logs")
|
contact = db.relationship(Contact, backref="email_logs")
|
||||||
|
mailbox = db.relationship("Mailbox", lazy="joined", foreign_keys=[mailbox_id])
|
||||||
@property
|
|
||||||
def mailbox(self) -> Optional["Mailbox"]:
|
|
||||||
if self.mailbox_id:
|
|
||||||
return Mailbox.get(self.mailbox_id)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def bounced_mailbox(self) -> str:
|
def bounced_mailbox(self) -> str:
|
||||||
if self.bounced_mailbox_id:
|
if self.bounced_mailbox_id:
|
||||||
|
|
Loading…
Reference in a new issue