remove URL field from wallet as seen and edited

This commit is contained in:
Philip Sargent 2022-09-19 20:55:34 +03:00
parent d2c6c4d7fb
commit 2648bada30
3 changed files with 18 additions and 21 deletions

View File

@ -61,7 +61,7 @@ todo = '''
WALLET_BLANK_JSON = { WALLET_BLANK_JSON = {
"cave": "", "cave": "",
"date": "", "date": "",
"description url": "1623/NNN", # "description url": "1623/NNN",
"description written": False, "description written": False,
"electronic survey": False, "electronic survey": False,
"elev drawn": False, "elev drawn": False,
@ -104,10 +104,11 @@ class WalletForm(forms.Form): # not a model-form, just a form-form
electronic = forms.CharField(strip=True, required=False) electronic = forms.CharField(strip=True, required=False)
pland = forms.CharField(strip=True, required=False) pland = forms.CharField(strip=True, required=False)
elevd = forms.CharField(strip=True, required=False) elevd = forms.CharField(strip=True, required=False)
url = forms.CharField(strip=True, required=False) #url = forms.CharField(strip=True, required=False)
survex = forms.CharField(strip=True, required=False) survex = forms.CharField(strip=True, required=False)
xlate = {"url": "description url", xlate = {
# "url": "description url",
"descriptionw": "description written", "descriptionw": "description written",
"people": "people", "people": "people",
"date": "date", "date": "date",
@ -200,15 +201,15 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl):
if not waldata["website updated"]: if not waldata["website updated"]:
complaints.append("The cave description website is marked as needing updating using the guidebook description from the survex file. Tick the 'Website updated' checkbox when this is done.") complaints.append("The cave description website is marked as needing updating using the guidebook description from the survex file. Tick the 'Website updated' checkbox when this is done.")
# FInd the cave, if it exists # Find the cave, if it exists
if waldata["cave"]: if waldata["cave"]:
try: try:
caveid = waldata["cave"] caveid = waldata["cave"]
caveid = caveid.replace("/","-") caveid = caveid.replace("/","-")
caveobject = getCave(caveid) caveobject = getCave(caveid)
print(f'getCave for id "{waldata["cave"]}" {caveobject}') print(f'getCave for id "{waldata["cave"]}" {caveobject}')
if not caveobject.url == waldata["description url"]: # if not caveobject.url == waldata["description url"]:
complaints.append(f'The URL of cave description \"{waldata["description url"]}\" does not match the one on record for this cave which is: "{caveobject.url}". If the wallet is not for a cave, put a useful URL here.') # complaints.append(f'The URL of cave description \"{waldata["description url"]}\" does not match the one on record for this cave which is: "{caveobject.url}". If the wallet is not for a cave, put a useful URL here.')
except Cave.MultipleObjectsReturned: except Cave.MultipleObjectsReturned:
complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.') complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.')
caveobject = None caveobject = None
@ -531,8 +532,9 @@ def scanupload(request, path=None):
return render(request, 'errors/generic.html', {'message': message}) return render(request, 'errors/generic.html', {'message': message})
print(f' - {svxfile=}') print(f' - {svxfile=}')
caves.append(svxfile.cave) if svxfile.cave:
caverefs.append(svxfile.cave.reference()) caves.append(svxfile.cave)
caverefs.append(svxfile.cave.reference())
blocks = SurvexBlock.objects.filter(survexfile= svxfile) blocks = SurvexBlock.objects.filter(survexfile= svxfile)
for b in blocks: for b in blocks:
print(f' - - {b=} {b.scanswallet=} {b.date=}') print(f' - - {b=} {b.scanswallet=} {b.date=}')
@ -563,14 +565,14 @@ def scanupload(request, path=None):
if len(caverefs) == 1: if len(caverefs) == 1:
waldata["cave"] = caverefs[0] waldata["cave"] = caverefs[0]
print(f' - Setting wallet cave to {caverefs[0]}') print(f' - Setting wallet cave to {caverefs[0]}')
waldata["description url"] = caves[0] # waldata["description url"] = caves[0]
elif len(caverefs) == 0: elif len(caverefs) == 0:
waldata["cave"] = "" waldata["cave"] = ""
waldata["description url"] = "" # waldata["description url"] = ""
print(f' - No caves in this wallet {wallet}. ') print(f' - No caves in this wallet {wallet}. ')
else: else:
waldata["cave"] = "several caves" waldata["cave"] = "several caves"
waldata["description url"] = "several.." # waldata["description url"] = "several.."
print(f' - More than one Cave {caves} in this wallet {wallet}. Not managed in this troggle release.') print(f' - More than one Cave {caves} in this wallet {wallet}. Not managed in this troggle release.')
if len(names) == 1: if len(names) == 1:
if waldata["name"] == '': if waldata["name"] == '':
@ -589,8 +591,8 @@ def scanupload(request, path=None):
cave = "" cave = ""
if waldata["name"]: if waldata["name"]:
psg = waldata["name"] psg = waldata["name"]
if not waldata["description url"]: # if not waldata["description url"]:
waldata["description url"]="" # waldata["description url"]=""
# find trips and survex files of the same date # find trips and survex files of the same date
if waldata["date"]: if waldata["date"]:
@ -641,7 +643,7 @@ def scanupload(request, path=None):
return render(request, 'walletform.html', return render(request, 'walletform.html',
{'form': form, 'wallet': wallet, **context, {'form': form, 'wallet': wallet, **context,
'date': waldata["date"], 'date': waldata["date"],
'url': waldata["description url"], 'urlsize': str(len(str(waldata["description url"]))), #'url': waldata["description url"], 'urlsize': str(len(str(waldata["description url"]))),
'survex': waldata["survex file"], 'survexsize': survexsize, 'survex': waldata["survex file"], 'survexsize': survexsize,
'cave': cave, 'psg': psg, 'psgsize': str(max(12,len(str(psg))))}) 'cave': cave, 'psg': psg, 'psgsize': str(max(12,len(str(psg))))})
else: # no wallet data: should never happen as their should be default data in all cases else: # no wallet data: should never happen as their should be default data in all cases

View File

@ -884,7 +884,7 @@ class LoadingSurvex():
team = self.rx_commteam.match(comment) team = self.rx_commteam.match(comment)
if team: if team:
print(f'rx_commteam -- {comment=} in {survexblock.survexfile.path} :: {survexblock}') # print(f'rx_commteam -- {comment=} in {survexblock.survexfile.path} :: {survexblock}')
pass pass
qml = self.rx_qm0.match(comment) qml = self.rx_qm0.match(comment)

View File

@ -179,12 +179,7 @@
label = "People" name = "people" size ="{{peoplesize}}" label = "People" name = "people" size ="{{peoplesize}}"
title="List of people on the survey trip" title="List of people on the survey trip"
placeholder="{{people}}" value="{{people}}" /> placeholder="{{people}}" value="{{people}}" />
<br>
<label for="url">URL of survey area (only needed if not a cave)</label>
<input
label = "URL" name = "url" size ="{{urlsize}}"
title="URL of cave description, e.g. /1623/264/264.html"
placeholder="{{url}}" value="{{url}}" />
<br> <br>
<label for="survex">List of survex files</label> <label for="survex">List of survex files</label>
<input <input