From 2648bada309fd5da0d66e32a9c6eade25ae0cc88 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 19 Sep 2022 20:55:34 +0300 Subject: [PATCH] remove URL field from wallet as seen and edited --- core/views/uploads.py | 30 ++++++++++++++++-------------- parsers/survex.py | 2 +- templates/walletform.html | 7 +------ 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/core/views/uploads.py b/core/views/uploads.py index 13c76e6..e476458 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -61,7 +61,7 @@ todo = ''' WALLET_BLANK_JSON = { "cave": "", "date": "", - "description url": "1623/NNN", +# "description url": "1623/NNN", "description written": False, "electronic survey": 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) pland = 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) -xlate = {"url": "description url", +xlate = { + # "url": "description url", "descriptionw": "description written", "people": "people", "date": "date", @@ -200,15 +201,15 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl): 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.") - # FInd the cave, if it exists + # Find the cave, if it exists if waldata["cave"]: try: caveid = waldata["cave"] caveid = caveid.replace("/","-") caveobject = getCave(caveid) print(f'getCave for id "{waldata["cave"]}" {caveobject}') - 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.') + # 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.') except Cave.MultipleObjectsReturned: complaints.append(f'The cave ID \'{waldata["cave"]}\' is AMBIGUOUS. Please fix it.') caveobject = None @@ -531,8 +532,9 @@ def scanupload(request, path=None): return render(request, 'errors/generic.html', {'message': message}) print(f' - {svxfile=}') - caves.append(svxfile.cave) - caverefs.append(svxfile.cave.reference()) + if svxfile.cave: + caves.append(svxfile.cave) + caverefs.append(svxfile.cave.reference()) blocks = SurvexBlock.objects.filter(survexfile= svxfile) for b in blocks: print(f' - - {b=} {b.scanswallet=} {b.date=}') @@ -563,14 +565,14 @@ def scanupload(request, path=None): if len(caverefs) == 1: waldata["cave"] = caverefs[0] print(f' - Setting wallet cave to {caverefs[0]}') - waldata["description url"] = caves[0] + # waldata["description url"] = caves[0] elif len(caverefs) == 0: waldata["cave"] = "" - waldata["description url"] = "" + # waldata["description url"] = "" print(f' - No caves in this wallet {wallet}. ') else: 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.') if len(names) == 1: if waldata["name"] == '': @@ -589,8 +591,8 @@ def scanupload(request, path=None): cave = "" if waldata["name"]: psg = waldata["name"] - if not waldata["description url"]: - waldata["description url"]="" + # if not waldata["description url"]: + # waldata["description url"]="" # find trips and survex files of the same date if waldata["date"]: @@ -641,7 +643,7 @@ def scanupload(request, path=None): return render(request, 'walletform.html', {'form': form, 'wallet': wallet, **context, '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, '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 diff --git a/parsers/survex.py b/parsers/survex.py index 75db0c6..7693826 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -884,7 +884,7 @@ class LoadingSurvex(): team = self.rx_commteam.match(comment) if team: - print(f'rx_commteam -- {comment=} in {survexblock.survexfile.path} :: {survexblock}') + # print(f'rx_commteam -- {comment=} in {survexblock.survexfile.path} :: {survexblock}') pass qml = self.rx_qm0.match(comment) diff --git a/templates/walletform.html b/templates/walletform.html index 357f08e..144fe15 100644 --- a/templates/walletform.html +++ b/templates/walletform.html @@ -179,12 +179,7 @@ label = "People" name = "people" size ="{{peoplesize}}" title="List of people on the survey trip" placeholder="{{people}}" value="{{people}}" /> -
- - +