From 5d6f47b85258b3c63766266a1ad460b74acdc7cb Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 22 May 2022 11:14:05 +0200 Subject: [PATCH] Fix snapshot diff update issue --- nummi/main/models.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nummi/main/models.py b/nummi/main/models.py index 83c924e..d2e761f 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -122,6 +122,13 @@ class Snapshot(models.Model): self.diff = self.value - self.previous.value super().save(*args, **kwargs) + try: + _next = self.__class__.objects.get(previous=self) + except self.__class__.DoesNotExist: + pass + else: + _next.save(only_super=True) + def delete(self, *args, only_super=False, **kwargs): if not only_super: try: