summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-08-24 19:08:08 +0300
committerPhilip Sargent <philip.sargent@klebos.com>2022-08-24 19:08:08 +0300
commit17bbbd6eabe24b169c66f2c6534f0b0589a69744 (patch)
tree463e34c5fb2b616eb40993e4e87cca780a41f8de
parent7e9fd0f353e26cb3440f8658d5da7b9f1992af82 (diff)
downloadtroggle-17bbbd6eabe24b169c66f2c6534f0b0589a69744.tar.gz
troggle-17bbbd6eabe24b169c66f2c6534f0b0589a69744.tar.bz2
troggle-17bbbd6eabe24b169c66f2c6534f0b0589a69744.zip
get the survexfile path when editing a naked wallet
-rw-r--r--core/views/scans.py5
-rw-r--r--core/views/uploads.py8
-rw-r--r--templates/personwallets.html2
3 files changed, 13 insertions, 2 deletions
diff --git a/core/views/scans.py b/core/views/scans.py
index 7274563..353db20 100644
--- a/core/views/scans.py
+++ b/core/views/scans.py
@@ -26,6 +26,11 @@ and render a user-friendly error page.
Note that datewallet(), caveifywallet() etc do NOT save the object to the db. They are ephemeral, just for the page rendering of the
manywallets dict.
+
+TODO
+cave for a wallet - just gets the last one, randomly. SHould make this a list or many:many ideally
+
+add this file in to the todo list thinggy.
'''
def populatewallet(w):
diff --git a/core/views/uploads.py b/core/views/uploads.py
index 919f130..4a8a6de 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -28,7 +28,7 @@ from troggle.parsers.scans import contentsjson
from troggle.core.models.troggle import DataIssue
from troggle.core.models.troggle import Expedition, Person, PersonExpedition
from troggle.core.models.caves import LogbookEntry, QM, Cave, PersonTrip
-from troggle.core.models.survex import DrawingFile, Wallet
+from troggle.core.models.survex import DrawingFile, Wallet, SurvexBlock
from troggle.core.views.scans import oldwallet, walletindex
from troggle.core.views.caves import getCave
@@ -251,6 +251,12 @@ def scanupload(request, path=None):
else: # no JSON file exists
print(f'--- No JSON exists, so creating blank copy')
waldata = WALLET_BLANK_JSON.copy()
+ if not waldata["survex file"]:
+ w = Wallet.objects.get(walletname=wallet)
+ b = SurvexBlock.objects.filter(scanswallet=w)
+ waldata["survex file"] = []
+ for bsf in b:
+ waldata["survex file"].append(bsf.survexfile.path)
return waldata
def save_json(jsondict):
diff --git a/templates/personwallets.html b/templates/personwallets.html
index 0c52765..0866480 100644
--- a/templates/personwallets.html
+++ b/templates/personwallets.html
@@ -20,7 +20,7 @@ traced to produce Tunnel or Therion drawings and eventually the final complete c
{% include 'wallet_table.html' %}
<br />
<table width=95%>
-<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Wallet Name</th><th width=15%>Other People</th><th>Cave</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
+<tr><th>Wallet</th><th width=8%>Wallet Date</th><th>Wallet Name</th><th width=15%>Team</th><th>Cave</th><th>Scans</th><th>Survex blocks</th><th>Drawings using these scans</th></tr>
{% for wallet in manywallets|dictsort:"walletname" %}
<tr>
<td style="padding:2px"><a href="{{wallet.get_absolute_url}}">{{wallet.walletname}}</a></td>