From 6482aa697fbc7823005018120befd0fd26baf1da Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Wed, 26 Jul 2023 17:38:19 +0300 Subject: [PATCH] helpful comments on form --- core/forms.py | 49 +++++++++++++++++++++++++++------------------ core/views/caves.py | 4 +--- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/core/forms.py b/core/forms.py index f6fdda6..f377361 100644 --- a/core/forms.py +++ b/core/forms.py @@ -119,68 +119,79 @@ class CaveForm(ModelForm): class EntranceForm(ModelForm): """Only those fields for which we want to override defaults are listed here - the other fields are present on the form, but use the default presentaiton style + the other fields are present on the form, but use the default presentation style """ name = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45"})) entrance_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) explorers = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45"})) # explorers = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10})) map_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) location_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) lastvisit = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Date of last visit" + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Date of last visit, e.g. 2023-07-11" ) approach = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) underground_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) photo = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) marking_comment = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) findability_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) other_description = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) bearings = forms.CharField( required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), + ) + tag_station = forms.CharField( + required=False, + widget=forms.TextInput(attrs={"size": "50"}), label="Tag station: Survex station id, e.g. 1623.p2023-xx-01" + ) + exact_station = forms.CharField( + required=False, + widget=forms.TextInput(attrs={"size": "50"}), label="Exact station: Survex station id, e.g. 1623.2023-xx-01.2" + ) + other_station = forms.CharField( + required=False, + widget=forms.TextInput(attrs={"size": "50"}), label="Other station: Survex station id, e.g. 1623.2023-xx-01.33" ) - other_station = forms.CharField(required=False) - tag_station = forms.CharField(required=False) - exact_station = forms.CharField(required=False) northing = forms.CharField(required=False) easting = forms.CharField(required=False) - lat_wgs84 = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Latitude (WSG84)") + lat_wgs84 = forms.CharField( + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Latitude (WSG84) - if no other location" + ) long_wgs84 = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Longitude (WSG84)" - ) + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Longitude (WSG84) - if no other location" + ) alt = forms.CharField(required=False, label="Altitude (m)") url = forms.CharField(required=False, label="URL [usually blank]", widget=forms.TextInput(attrs={"size": "45"})) - field_order = ['name', 'entrance_description', 'explorers', 'map_description', 'location_description', 'lastvisit', 'approach', 'underground_description', 'photo', 'marking_comment', 'findability_description', 'other_description', 'bearings', 'other_station', 'tag_station', 'exact_station', 'northing', 'easting', 'lat_wgs84', 'long_wgs84', 'alt', 'url'] + field_order = ['name', 'entrance_description', 'explorers', 'map_description', 'location_description', 'lastvisit', 'approach', 'underground_description', 'photo', 'marking_comment', 'findability_description', 'other_description', 'bearings', 'tag_station', 'exact_station', 'other_station', 'northing', 'easting', 'lat_wgs84', 'long_wgs84', 'alt', 'url'] class Meta: model = Entrance diff --git a/core/views/caves.py b/core/views/caves.py index cb4496e..1dbb1e9 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -485,10 +485,8 @@ def edit_entrance(request, path="", caveslug=None, entslug=None): entrance_letter.entrance = entrance entrance_letter.save() - if not entrance.filename: - print(f"! BARF - why no filename set? '{entslug}' letter:{entletter.cleaned_data['entrance_letter']}") entrance_file = entrance.file_output() - print(f"Online edit of entrance {entrance.slug}") + # print(f"Online edit of entrance {entrance.slug}") cave_file = cave.file_output() write_and_commit([entrance_file, cave_file], f"Online edit of entrance {entrance.slug}") return HttpResponseRedirect("/" + cave.url)