2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

get the survexfile path when editing a naked wallet

This commit is contained in:
Philip Sargent 2022-08-24 19:08:08 +03:00
parent 7e9fd0f353
commit 17bbbd6eab
3 changed files with 13 additions and 2 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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>