Add snapshot form
This commit is contained in:
parent
4b784a553b
commit
cb458cf472
17 changed files with 159 additions and 372 deletions
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue