2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

Fix to not create an extra wallet

This commit is contained in:
Philip Sargent 2023-02-01 19:31:29 +00:00
parent 587ccff501
commit 5ae37eef82

View File

@ -274,7 +274,9 @@ def walletedit(request, path=None):
actual_saved = []
def get_next_empty():
latest = Wallet.objects.filter(walletname__startswith="20").latest('walletname')
"""Gets the next most number for a new wallet just after the most recent one in the
db. But if it has no date set, then ignore it as it was only just created"""
latest = Wallet.objects.filter(walletname__startswith="20",walletdate__isnull=False).latest('walletname')
next = int(latest.walletname[5:]) + 1
return f"{latest.walletname[:4]}:{next:02d}"
@ -456,6 +458,7 @@ def walletedit(request, path=None):
form = FilesForm()
if request.method == "POST":
# print(f'--- POST processing starts {wallet=} {path=}')
if "psg" in request.POST: # handle metadata form
formj = WalletForm(request.POST)
# Beware. All fields returned as strings. Must re-type them as lists etc. before using or re-saving