Add snapshot form

This commit is contained in:
Edgar P. Burkhart 2022-05-22 10:06:44 +02:00
parent 4b784a553b
commit cb458cf472
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
17 changed files with 159 additions and 372 deletions

View file

@ -94,6 +94,7 @@ class Snapshot(models.Model):
if not only_super:
_prev = (
self.__class__.objects.order_by("-date")
.exclude(id=self.id)
.filter(date__lt=self.date)
.first()
)
@ -139,3 +140,9 @@ class Snapshot(models.Model):
class Meta:
ordering = ["-date"]
class SnapshotForm(ModelForm):
class Meta:
model = Snapshot
fields = ["date", "value"]