From 7570a0d37a05951b8f2211de72713bd5d7248a01 Mon Sep 17 00:00:00 2001 From: Pietro Date: Wed, 27 Dec 2023 00:40:48 +0100 Subject: [PATCH] Update django_mailbox/models.py Co-authored-by: Pascal Fouque --- django_mailbox/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_mailbox/models.py b/django_mailbox/models.py index c623cdf..a27b5b2 100644 --- a/django_mailbox/models.py +++ b/django_mailbox/models.py @@ -881,7 +881,9 @@ class MessageAttachment(models.Model): return value def __str__(self): - return f'{self.message}: {self.document.url if self.document else None}' + if self.document: + return f'{self.get_filename()}: {self.document.url}' + return self.get_filename() class Meta: