summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/TESTS/test_imports.py4
-rw-r--r--core/views/wallets_edit.py (renamed from core/views/wallets.py)10
-rw-r--r--urls.py2
3 files changed, 9 insertions, 7 deletions
diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py
index 636f0b8..5ec62ee 100644
--- a/core/TESTS/test_imports.py
+++ b/core/TESTS/test_imports.py
@@ -16,7 +16,7 @@ But paths like this:
which rely on database resolution will fail unless a fixture has been set up for
them.
-https://docs.djangoproject.com/en/3.0/topics/testing/tools/
+https://docs.djangoproject.com/en/3.2/topics/testing/tools/
"""
import re
import subprocess
@@ -58,7 +58,7 @@ class SimpleTest(SimpleTestCase):
from troggle.core.views.uploads import dwgupload
def test_import_views_walletedit(self):
- from troggle.core.views.wallets import walletedit
+ from troggle.core.views.wallets_edit import walletedit
def test_import_parsers_QMs(self):
from troggle.core.models.logbooks import QM
diff --git a/core/views/wallets.py b/core/views/wallets_edit.py
index 12b2e01..a58aee8 100644
--- a/core/views/wallets.py
+++ b/core/views/wallets_edit.py
@@ -33,7 +33,7 @@ from troggle.parsers.scans import contentsjson
todo = """
- Register uploaded filenames in the Django db without needing to wait for a reset & bulk file import
-- Refactor walletedit() as it contains all the wallets 'complaints' code from the old script wallets.py
+- Refactor walletedit() as it contains all the wallets 'complaints' code from the pre-2022 script wallets.py
- Need to validate uploaded file as being a valid image file, not a dubious script or hack
"""
@@ -56,7 +56,6 @@ WALLET_BLANK_JSON = {
"website updated": False,
}
-
class WalletGotoForm(forms.Form): # not a model-form, just a form-form
walletgoto = forms.CharField(strip=True, required=False)
@@ -408,6 +407,7 @@ def walletedit(request, path=None):
# print(f"--- Wallet string {walletname}, wallet object {w} created new?: {created}")
if created:
w.fpath = Path(settings.SCANS_ROOT, walletname[0:4], walletname)
+ _ = w.year() # sets the walletyear property as a side-effect
w.save()
except:
print(f"!-- Wallet string {walletname}, FAIL TO GET or create WALLET OBJECT")
@@ -530,7 +530,8 @@ def walletedit(request, path=None):
# print(f'--- {wd["survex file"]} - {type(wd["survex file"])}')
save_json(wd)
- walletobject = make_wallet(wallet) # will already exist
+ # will already exist as creation does not happen here anymore
+ walletobject = make_wallet(wallet)
commit_json(wd)
else:
@@ -547,7 +548,8 @@ def walletedit(request, path=None):
return HttpResponseRedirect(f'/walletedit/{walletgoto.replace("#",":")}')
- else: # not editing wallet data, creating a wallet or uploading a file. Should not overwrite metadata at all.
+ else: # Creating a wallet .
+ # NOT editing wallet data, or uploading a file. Should not overwrite metadata at all.
if "submitbutton" in request.POST:
print(f"--- Submit button value {request.POST['submitbutton']}")
if request.POST['submitbutton']=="Create":
diff --git a/urls.py b/urls.py
index 2374d92..5012716 100644
--- a/urls.py
+++ b/urls.py
@@ -23,7 +23,7 @@ from troggle.core.views.prospect import prospecting
from troggle.core.views.scans import (allscans, cavewallets, scansingle,
walletslistperson, walletslistyear)
from troggle.core.views.uploads import dwgupload, photoupload
-from troggle.core.views.wallets import walletedit
+from troggle.core.views.wallets_edit import walletedit
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
to resolve urls - in both directions as these are declarative.