From 6bc0884d43e54718d95847359e1abf4d221247f0 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 14 Nov 2023 15:55:11 +0200 Subject: [PATCH] better labels on forms --- core/forms.py | 73 ++++++++++++++++++++++++++----------- templates/editcave.html | 23 ++++++++++++ templates/editentrance.html | 4 ++ 3 files changed, 78 insertions(+), 22 deletions(-) diff --git a/core/forms.py b/core/forms.py index ffeaa11..0d03d19 100644 --- a/core/forms.py +++ b/core/forms.py @@ -33,8 +33,15 @@ class CaveForm(ModelForm): """Only those fields for which we want to override defaults are listed here the other fields of the class Cave are present on the form, but use the default presentation style """ - - official_name = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45"})) + unofficial_number= forms.CharField(required=False, + label="Unofficial Number used to construct internal identifiers", + widget=forms.TextInput( + attrs={"size": "45", "placeholder": "2035-ZB-03"})) + + official_name = forms.CharField(required=False, + label="Name:",widget=forms.TextInput( + attrs={"size": "45", "placeholder": "ideally official name in German, but any name is OK"})) + underground_description = forms.CharField( required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), @@ -52,7 +59,14 @@ class CaveForm(ModelForm): widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), ) # survey = forms.CharField(required = False, widget=TinyMCE(attrs={'cols': 80, 'rows': 10})) - kataster_status = forms.CharField(required=False) + kataster_status = forms.CharField(required=False, + label = "Kataster status, see below", + widget=forms.TextInput(attrs={"placeholder": "see example below"}) + ) + kataster_code = forms.CharField(required=False, + label = "Kataster code, see below", + widget=forms.TextInput(attrs={"placeholder": "see example below"}) + ) underground_centre_line = forms.CharField( required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), @@ -65,21 +79,23 @@ class CaveForm(ModelForm): required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter page content (using HTML)"}), ) - description_file = forms.CharField(required=False, label="Path of top-level description file for this cave, when a separate file is used. Otherwise blank.", widget=forms.TextInput(attrs={"size": "45"}), help_text="") + description_file = forms.CharField(required=False, label="Path of top-level description file for this cave, when a separate file is used. Otherwise blank.", widget=forms.TextInput(attrs={"size": "45","placeholder": "usually blank"}), help_text="") survex_file = forms.CharField( required=False, label="Survex file eg. caves-1623/000/000.svx", widget=forms.TextInput(attrs={"size": "45"}) ) - length = forms.CharField(required=False, label="Length (m)") - depth = forms.CharField(required=False, label="Depth (m)") - extent = forms.CharField(required=False, label="Extent (m)") - + length = forms.CharField(required=False, label="Length (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"})) + depth = forms.CharField(required=False, label="Depth (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"})) + extent = forms.CharField(required=False, label="Extent (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"})) + subarea = forms.CharField(required=False, label="Subarea", widget=forms.TextInput(attrs={"placeholder": "usually blank, archaic"})) + #cave_slug = forms.CharField() class Meta: model = Cave exclude = ("filename","url") - field_order = ['unofficial_number', 'kataster_number', 'official_name', 'underground_description', 'explorers', 'equipment', 'survey', 'kataster_status', 'kataster_code','underground_centre_line', 'notes', 'references', 'description_file', 'survex_file', 'areacode', 'length', 'depth', 'extent'] + field_order = ['unofficial_number', 'kataster_number', 'official_name', 'underground_description', 'survey', 'underground_centre_line', 'explorers', 'equipment', 'notes', 'references', 'description_file', 'survex_file', 'areacode', 'length', 'depth', 'extent', + 'kataster_code', 'kataster_status' ] def clean_cave_slug(self): if self.cleaned_data["cave_slug"] == "": @@ -115,7 +131,7 @@ class EntranceForm(ModelForm): 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"})) + name = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45", "placeholder": "usually leave this blank"})) entrance_description = forms.CharField( required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), @@ -123,15 +139,17 @@ class EntranceForm(ModelForm): 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( + label="Map (is this used?)", required=False, widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) location_description = forms.CharField( + label="Location", required=False, 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, e.g. 2023-07-11" + required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Last visit date, e.g. 2023-07-11" ) approach = forms.CharField( required=False, @@ -142,50 +160,61 @@ class EntranceForm(ModelForm): widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) photo = forms.CharField( + label="Photos (use 'image' button)", + required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Use button on right to add HTML link"}), ) marking_comment = forms.CharField( + label="Marking text", required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter exact tag text, e.g. 'CUCC 2035 ZB-03'"}), ) findability_description = forms.CharField( required=False, + label="How to find it", widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), ) other_description = forms.CharField( + label="Other comments", required=False, - widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Enter text (using HTML)"}), + 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": "Enter text (using HTML)"}), + widget=HTMLarea(attrs={"height": "80%", "rows": 20, "placeholder": "Usually blank"}), ) tag_station = forms.CharField( required=False, - widget=forms.TextInput(attrs={"size": "50"}), label="Tag station: Survex station id, e.g. 1623.p2023-aa-01" + widget=forms.TextInput(attrs={"size": "50","placeholder": "e.g. 1623.t2035-zb-03a"}), + label="Tag station: Survex station id, e.g. 1623.p2023-aa-01" ) other_station = forms.CharField( required=False, - widget=forms.TextInput(attrs={"size": "50"}), label="Other station: Survex station id, e.g. 1623.gps2018-aa-01" + widget=forms.TextInput(attrs={"size": "50","placeholder": "e.g. 1623.p2035-zb-03c"}), + label="Other station: Survex station id, e.g. 1623.gps2018-aa-01" ) lat_wgs84 = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Latitude (WSG84) - if no other location" + required=False, widget=forms.TextInput(attrs={"size": "10","placeholder": "e.g. 47.123456"}), + label="Latitude (WSG84) - if no other location" ) long_wgs84 = forms.CharField( - required=False, widget=forms.TextInput(attrs={"size": "10"}), label="Longitude (WSG84) - if no other location" + required=False, widget=forms.TextInput(attrs={"size": "10","placeholder": "e.g. 13.123456"}), + label="Longitude (WSG84) - if no other location" ) alt = forms.CharField(required=False, label="Altitude (m) - from GPS if you have it, but let it settle.") - url = forms.CharField(required=False, label="URL [usually blank]", widget=forms.TextInput(attrs={"size": "45"})) + # 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', 'tag_station', 'other_station', 'easting', 'northing', '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', 'other_station', 'easting', 'northing', 'lat_wgs84', 'long_wgs84', 'alt'] class Meta: model = Entrance exclude = ( "cached_primary_slug", - "filename" + "filename", + "slug" ) def clean(self): diff --git a/templates/editcave.html b/templates/editcave.html index bc3514d..9a238b4 100644 --- a/templates/editcave.html +++ b/templates/editcave.html @@ -53,11 +53,34 @@ and these same fields appear in the alternative file upload process as described {% endif %} {% include 'html_editor_pop_ups.html' %} + +

{{message}}

+
{% csrf_token %} {{ form }} {{caveAndEntranceFormSet}}

+

kataster code

+This is the 'length-or-depth/type exploration' +code used in the Austrian kataster, e.g '1/S +' +means "more than 10 but less than 50m long or deep, with a pitch, completely explored". +
+    T   Trockenhöhlen (Dry caves)
+    W   Wasserhöhlen (Caves with water)
+   (W)  Zeitweilig aktiv Wasserhöhlen (Caves with seasonal water)
+    E   Eishohlen (Caves with ice formations)
+    S   Schachthöhlen (Caves with pitches)
+    H   Halbhöhlen (Rock shelters ?)
+
+

kataster status

+    -   unerforscht (unexplored)
+    =   befahren (visited)
+    ×   teilweise vermessen (partly surveyed)
+    +   erforscht (exploration considered complete)
+
{% endblock %} diff --git a/templates/editentrance.html b/templates/editentrance.html index 2691d6e..00fd196 100644 --- a/templates/editentrance.html +++ b/templates/editentrance.html @@ -7,7 +7,11 @@ {% block content %}

Edit Entrance at cave {{cave.official_name|safe}} - {{cave.unofficial_number}} - {{cave.kataster_number}}

{% include 'html_editor_pop_ups.html' %} + +

{{message}}

+
{% csrf_token %}

First, DO YOU KNOW how to use *fix data in survex files ?