diff --git a/core/views/uploads.py b/core/views/uploads.py index f2fa85a..e1c1c8e 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -61,6 +61,7 @@ todo = ''' WALLET_BLANK_JSON = { "cave": "", "date": "", + "free text": "", # "description url": "1623/NNN", "description written": False, "electronic survey": False, @@ -100,6 +101,7 @@ class WalletForm(forms.Form): # not a model-form, just a form-form elevnr = forms.CharField(strip=True, required=False) cave = forms.CharField(strip=True, required=False) psg = forms.CharField(strip=True, required=False) + freetext = forms.CharField(strip=True, required=False) plannr = forms.CharField(strip=True, required=False) electronic = forms.CharField(strip=True, required=False) pland = forms.CharField(strip=True, required=False) @@ -122,6 +124,7 @@ xlate = { "pland": "plan drawn", "elevd": "elev drawn", "psg": "name", # a name for this wallet + "freetext": "free text", "survex": "survex file", } @@ -167,15 +170,15 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl): try: svxfile = SurvexFile.objects.get(path=sx) except: - file_complaint = f"{wallet} Survex file name {sx} was not imported via a *include statement." + file_complaint = f"{wallet} Survex file name {sx} was not imported via a *include statement so it not available." complaints.append(file_complaint) message = f"! {file_complaint}" print(message) DataIssue.objects.update_or_create(parser='scans', message=message, url=wurl) # set URL to this wallet folder - if waldata["survex not required"] and waldata["survex file"] != "": - survex_complaint = "Survex is stated as not required and yet there is a survex file!" - if not waldata["survex not required"] and waldata["survex file"] == "": + if waldata["survex not required"] and waldata["survex file"] != [""]: + survex_complaint = f'Survex is stated as not required and yet there is a survex file! ({waldata["survex file"]})' + if not waldata["survex not required"] and waldata["survex file"] == [""]: survex_complaint = "A survex file is required, but has not been specified!" if survex_complaint: complaints.append(survex_complaint) @@ -231,7 +234,7 @@ def get_complaints(complaints, waldata, svxfiles, files, wallet, wurl): complaints.append(f'The cave ID \'{waldata["cave"]}\' is not recognised. Please fix it.') caveobject = None else: - complaints.append(f'No cave ID is given. If there is no survex file, please give some text, even if it is just "surface survey" or "scraps found in hut"') + complaints.append(f'No cave ID is given. If there is no survex file, please give something, even if it is just "1623-000", "surface survey" or "scraps found in hut"') caveobject = None @@ -506,6 +509,7 @@ def scanupload(request, path=None): else: metadataurl = Path("/dwgdataraw", "walletjson") / wallet[0:4] / wallet.replace("#",":") / "contents.json" psg = "" + freetext = "" chkplannr = "" chkpland = "" svxfiles = [] @@ -614,8 +618,8 @@ def scanupload(request, path=None): cave = "" if waldata["name"]: psg = waldata["name"] - # if not waldata["description url"]: - # waldata["description url"]="" + if "free text" in waldata: + freetext = waldata["free text"] # find trips and survex files of the same date if waldata["date"]: @@ -668,7 +672,7 @@ def scanupload(request, path=None): 'date': waldata["date"], #'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))))}) + 'cave': cave, 'psg': psg, 'freetext': freetext,'psgsize': str(max(12,len(str(psg)))), 'freetextsize': str(max(60,len(str(freetext))))}) else: # no wallet data: should never happen as their should be default data in all cases context = {'year': year, 'prev': prev, 'next': next, 'prevy': prevy, 'nexty': nexty, 'files': files, 'dirs': dirs, 'waldata': waldata, 'svxfiles': svxfiles, @@ -680,9 +684,9 @@ def scanupload(request, path=None): return render(request, 'walletform.html', {'form': form, 'wallet': wallet, **context, 'date': "", - 'url': "", 'urlsize': 12, + #'url': "", 'urlsize': 12, 'survex': "", 'survexsize': 46, - 'cave': cave, 'psg': psg, 'psgsize': 12}) + 'cave': cave, 'psg': psg, 'freetext': freetext,'psgsize': 12, 'freetextsize': 20}) @login_required_if_public def photoupload(request, folder=None): diff --git a/templates/walletform.html b/templates/walletform.html index 144fe15..41df051 100644 --- a/templates/walletform.html +++ b/templates/walletform.html @@ -146,6 +146,12 @@ label = "Survey area" name = "psg" size ="{{psgsize}}" title="Survey area, e.g. White Elephant or Nieder Augst Eck" placeholder="{{psg}}" value="{{psg}}" /> +
+ +