diff --git a/nummi/main/models.py b/nummi/main/models.py index ffde2ef..224cf58 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -146,9 +146,10 @@ class Snapshot(AccountModel): ) def __str__(self): - return "{} – {}".format( - _("%(date)s statement") % {"date": self.date}, self.account - ) + desc = _("%(date)s statement") % {"date": self.date} + if hasattr(self, "account"): + return f"{desc} – {self.account}" + return desc def save(self, *args, **kwargs): if Snapshot.objects.filter(id=self.id).exists():