Fix snapshot diff update issue
This commit is contained in:
parent
0e60dfba27
commit
5d6f47b852
1 changed files with 7 additions and 0 deletions
|
@ -122,6 +122,13 @@ class Snapshot(models.Model):
|
||||||
self.diff = self.value - self.previous.value
|
self.diff = self.value - self.previous.value
|
||||||
super().save(*args, **kwargs)
|
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):
|
def delete(self, *args, only_super=False, **kwargs):
|
||||||
if not only_super:
|
if not only_super:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue