From dfc58a281e9c02b8ee2b855c41459c2714ee2268 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 6 Aug 2021 16:40:22 +0200 Subject: [PATCH] Fix: Deposit creation form when no deposit items exist --- deposits/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deposits/models.py b/deposits/models.py index 09c1f349..6469f6e4 100644 --- a/deposits/models.py +++ b/deposits/models.py @@ -61,8 +61,8 @@ class Deposit(RevMixin, AclMixin, models.Model): def __init__(self, *args, **kwargs): super(Deposit, self).__init__(*args, **kwargs) - self.__original_item = self.item - self.__original_deposit_amount = self.deposit_amount + self.__original_item = getattr(self, "item", None) + self.__original_deposit_amount = getattr(self, "deposit_amount", None) def __str__(self): if self.returned: