From bae4fed8d685ece3d784daeb899e4fdd28dab783 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Fri, 30 Dec 2022 18:22:27 +0100 Subject: [PATCH] Fix create snapshot bug --- nummi/main/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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():