2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

better labels on forms

This commit is contained in:
Philip Sargent 2023-11-14 15:55:11 +02:00
parent d2ee32d3e6
commit 6bc0884d43
3 changed files with 78 additions and 22 deletions

View File

@ -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
"""
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"}))
official_name = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45"}))
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,13 +79,14 @@ 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()
@ -79,7 +94,8 @@ class CaveForm(ModelForm):
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):

View File

@ -53,11 +53,34 @@ and these same fields appear in the alternative file upload process as described
</div>
{% endif %}
{% include 'html_editor_pop_ups.html' %}
<!-- If you are looking for the furniture that creates the fields on this form, you need to look
at troggle/core/forms.py ass this uses a Django magic form creation thinggy. -->
<h2>{{message}}</h2>
<form action="" method="post">{% csrf_token %}
<table>{{ form }}
<!-- begin caveAndEntranceFormSet-->{{caveAndEntranceFormSet}}<!--end caveAndEntranceFormSet--></table>
<p><input type="submit" value="Submit" /></p>
</form>
<h3>kataster code</h3>
This is the 'length-or-depth/type exploration'
<a href="/katast.htm
">code used in the Austrian kataster</a>, e.g '1/S +'
means "more than 10 but less than 50m long or deep, with a pitch, completely explored".
<pre>
T Trockenh&ouml;hlen (Dry caves)
W Wasserh&ouml;hlen (Caves with water)
(W) Zeitweilig aktiv Wasserh&ouml;hlen (Caves with seasonal water)
E Eishohlen (Caves with ice formations)
S Schachth&ouml;hlen (Caves with pitches)
H Halbh&ouml;hlen (Rock shelters ?)
</pre>
<h3>kataster status</h3><pre>
- unerforscht (unexplored)
= befahren (visited)
× teilweise vermessen (partly surveyed)
+ erforscht (exploration considered complete)
</pre>
{% endblock %}

View File

@ -7,7 +7,11 @@
{% block content %}
<h1>Edit Entrance at cave {{cave.official_name|safe}} - {{cave.unofficial_number}} - {{cave.kataster_number}}</h1>
{% include 'html_editor_pop_ups.html' %}
<!-- If you are looking for the furniture that creates the fields on this form, you need to look
at troggle/core/forms.py ass this uses a Django magic form creation thinggy. -->
<h2>{{message}}</h2>
<form action="" method="post">{% csrf_token %}
<p>First, <em>DO YOU KNOW</em> how to use *fix data in survex files ?
<ul>