mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
renamed wallet form file
This commit is contained in:
parent
5798e8dcd5
commit
c7d88077ec
@ -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
|
||||
|
@ -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":
|
2
urls.py
2
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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user