From 7a61bc47eae0568eb32b5529e4ca9c59da5150e6 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 18 Nov 2023 13:27:08 +0000 Subject: [PATCH] Make 'bearings' a read-only field on entrances --- core/forms.py | 13 +++++++------ core/views/caves.py | 1 + parsers/survex.py | 5 ++--- templates/editentrance.html | 5 ++++- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/core/forms.py b/core/forms.py index 05b982a..bd90490 100644 --- a/core/forms.py +++ b/core/forms.py @@ -180,11 +180,11 @@ class EntranceForm(ModelForm): required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Usually blank"}), ) - bearings = forms.CharField( - label="Bearings (obsolete)", - required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Usually blank"}), - ) + # bearings = forms.CharField( + # label="Bearings (obsolete)", + # required=False, + # widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Usually blank"}), + # ) tag_station = forms.CharField( required=False, widget=forms.TextInput(attrs={"size": "50","placeholder": "e.g. 1623.t2035-zb-03a"}), @@ -214,7 +214,8 @@ class EntranceForm(ModelForm): exclude = ( "cached_primary_slug", "filename", - "slug" + "slug", + "bearings" ) def clean(self): diff --git a/core/views/caves.py b/core/views/caves.py index 0d8c3e9..0811567 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -663,6 +663,7 @@ def edit_entrance(request, path="", caveslug=None, entslug=None): { "entform": entform, "cave": cave, + "ent": entrance, "entletter": entletter, "entletterform": entletterform, # is unset if not being used "entlettereditable": entlettereditable, diff --git a/parsers/survex.py b/parsers/survex.py index 9c5950c..3a4d42c 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -2416,7 +2416,6 @@ def FindAndLoadSurvex(): print(f" - Number of Survex legs: {legsnumber:,}") for f in svx_load.fixes: - # why are we seeing no *fixes from fixedpts/gps18.svx etc. ? They are parsed ! survexblock, name, altitude, comment = svx_load.fixes[f] s = survexblock spath = s.parent.survexfile @@ -2431,9 +2430,9 @@ def FindAndLoadSurvex(): if comment: # print(f"FIX {survexblock} {altitude} {comment}") if re.match("(?i)[^s]*srtm[\s\S]*", comment.lower()): - print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - '{comment}'") + print(f"SRTM {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'") if re.match("(?i)[^s]*radost[\s\S]*", comment.lower()): - print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - '{comment}'") + print(f"RDST {ff}.svx::{survexblock} - {spath}.svx - alt={altitude} '{comment}'") svx_load = None diff --git a/templates/editentrance.html b/templates/editentrance.html index 00fd196..a104ec3 100644 --- a/templates/editentrance.html +++ b/templates/editentrance.html @@ -40,7 +40,10 @@ at troggle/core/forms.py ass this uses a Django magic form creation thinggy. --> {% else %}
Entrance Letter{{ entletter }}
{% endif %} - {{ entform }}
+ {{ entform }} + +
+{{ent.bearings|safe}}