summaryrefslogtreecommitdiffstats
path: root/core/views/uploads.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-08-31 12:09:07 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-08-31 12:09:07 +0300
commit6452a7beed18072719b27239b95cb7d081d81dc3 (patch)
treedfe6c74d6106b4ecfc331fecc566376fcea4d3d9 /core/views/uploads.py
parent5c667c182600ef58554be6bbeb54b8c0561cbcd4 (diff)
downloadtroggle-6452a7beed18072719b27239b95cb7d081d81dc3.tar.gz
troggle-6452a7beed18072719b27239b95cb7d081d81dc3.tar.bz2
troggle-6452a7beed18072719b27239b95cb7d081d81dc3.zip
fix green block for survex files on table
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r--core/views/uploads.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index f46db92..860cba7 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -240,7 +240,7 @@ def scanupload(request, path=None):
git = settings.GIT
filesaved = False
actual_saved = []
-
+
def read_json():
'''Read JSON from the wallet metadata file in the repo
or fills with blank data if that files can't be read'''
@@ -472,7 +472,12 @@ def scanupload(request, path=None):
waldata = read_json()
- cave =""
+ jsonfile = Path(settings.DRAWINGS_DATA, "walletjson") / wallet[0:4] / wallet / "contents.json"
+ print(f'! - FORM scanupload - jsonfile {jsonfile}')
+ if not Path(jsonfile).is_file():
+ metadataurl = ""
+ else:
+ metadataurl = Path("/dwgdataraw", "walletjson") / wallet[0:4] / wallet.replace("#",":") / "contents.json"
psg = ""
chkplannr = ""
chkpland = ""
@@ -565,14 +570,16 @@ def scanupload(request, path=None):
waldata["name"] = f"several, please edit: {names}"
print(f' - More than one block name is relevant {names} in this wallet {wallet}. Not managed in this troggle release.')
- if waldata["cave"]:
+ if "cave" in waldata:
cave = waldata["cave"] # text string
+ else:
+ cave = ""
if waldata["name"]:
psg = waldata["name"]
if not waldata["description url"]:
waldata["description url"]=""
- #Survex and survex complaints
+ #Survex and survex complaints, comes from json file on disc, not as pre-populated as above
complaints, caveobject = get_complaints([], waldata, svxfiles, files, wallet, wurl)
# print(f' - {caveobject=}')
@@ -586,7 +593,7 @@ def scanupload(request, path=None):
context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty,
'files': files, 'dirs': dirs, 'waldata': waldata, 'svxfiles': svxfiles,
'checked': checked,
- 'create': create,
+ 'create': create, 'metadataurl': metadataurl,
'complaints': complaints,
'caveobject': caveobject,
'people': waldata["people"], 'peoplesize': str(len(str(waldata["people"]))),