From e70d51e52b3179ae9a17ab7fdf93236ebf3bd7df Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 3 Feb 2023 11:34:38 +0000 Subject: [PATCH] Made JSON visible on wallet edit page --- core/views/wallets_edit.py | 4 ++++ templates/walletform.html | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/core/views/wallets_edit.py b/core/views/wallets_edit.py index 6083dab..c5468a4 100644 --- a/core/views/wallets_edit.py +++ b/core/views/wallets_edit.py @@ -632,8 +632,11 @@ def walletedit(request, path=None): # print(f'! - FORM walletedit - jsonfile {jsonfile}') if not Path(jsonfile).is_file(): metadataurl = "" + metadata ="" else: metadataurl = Path("/dwgdataraw", "walletjson") / wallet[0:4] / wallet.replace("#", ":") / "contents.json" + with open(jsonfile, 'r') as f: + metadata = f.read() psg = "" freetext = "" chkplannr = "" @@ -826,6 +829,7 @@ def walletedit(request, path=None): "svxothers": svxothers, "create": create, "metadataurl": metadataurl, + "metadata": metadata, "complaints": complaints, "caveobject": caveobject, "people": waldata["people"], diff --git a/templates/walletform.html b/templates/walletform.html index b1681f3..6ac419a 100644 --- a/templates/walletform.html +++ b/templates/walletform.html @@ -253,10 +253,20 @@ {% else %} No other survex files found for this date.
{% endif %} - {% if metadataurl %}Debug: - - json file
{% endif %} -
+ + {% if metadataurl %}
+ JSON
+
+ {{metadataurl}}
+
+    {{metadata}}
+    
+
+ {% else %} + No JSON file yet.
+
+ {% endif %} {% endif %} +
{% endblock %}