Fix bugs with snapshots: opening earliest snapshot, deleting latest

This commit is contained in:
Edgar P. Burkhart 2022-05-22 10:39:29 +02:00
parent 57ace376d8
commit 02b0fae3f7
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 7 additions and 4 deletions

View file

@ -123,9 +123,12 @@ def snapshot(request, date=None):
_transactions = None
else:
_snapshot = get_object_or_404(Snapshot, date=date)
_transactions = Transaction.objects.filter(
date__lt=_snapshot.date, date__gte=_snapshot.previous.date
)
if _snapshot.previous is None:
_transactions = None
else:
_transactions = Transaction.objects.filter(
date__lt=_snapshot.date, date__gte=_snapshot.previous.date
)
return render(
request,
"main/snapshot.html",