diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-02-01 19:31:29 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-02-01 19:31:29 +0000 |
commit | 5ae37eef8251fd9aa709f50658dc5ed26c19e1aa (patch) | |
tree | a009baf18e355744c0d2a80b0fe648d294c9e08e /core/views/wallets.py | |
parent | 587ccff50110804cbff356d07c56ecea72ccf1fa (diff) | |
download | troggle-5ae37eef8251fd9aa709f50658dc5ed26c19e1aa.tar.gz troggle-5ae37eef8251fd9aa709f50658dc5ed26c19e1aa.tar.bz2 troggle-5ae37eef8251fd9aa709f50658dc5ed26c19e1aa.zip |
Fix to not create an extra wallet
Diffstat (limited to 'core/views/wallets.py')
-rw-r--r-- | core/views/wallets.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/views/wallets.py b/core/views/wallets.py index 0d8ecd0..0b9f426 100644 --- a/core/views/wallets.py +++ b/core/views/wallets.py @@ -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 |