diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-11-14 15:55:11 +0200 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-11-14 15:55:11 +0200 |
commit | 6bc0884d43e54718d95847359e1abf4d221247f0 (patch) | |
tree | 9565c4e71bea8cff6a56c92d76857f55cf96c8d0 /core/forms.py | |
parent | d2ee32d3e651c4fd9c06bc962ba1e2e9653c3fae (diff) | |
download | troggle-6bc0884d43e54718d95847359e1abf4d221247f0.tar.gz troggle-6bc0884d43e54718d95847359e1abf4d221247f0.tar.bz2 troggle-6bc0884d43e54718d95847359e1abf4d221247f0.zip |
better labels on forms
Diffstat (limited to 'core/forms.py')
-rw-r--r-- | core/forms.py | 73 |
1 files changed, 51 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): |