2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 01:27:08 +00:00

cookie and logon working nicely together: cave & entrance

This commit is contained in:
2025-02-13 17:30:40 +00:00
parent ae36f1a9ce
commit 9fd86dc0c4
3 changed files with 30 additions and 14 deletions

View File

@@ -45,6 +45,7 @@ todo = """
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
Extra fields, not in the model Cave, are also created here, e.g. who_are_you
see https://docs.djangoproject.com/en/5.1/topics/forms/modelforms/
"""
@@ -106,6 +107,7 @@ class CaveForm(ModelForm):
subarea = forms.CharField(required=False, label="Subarea (do not use for new caves)", widget=forms.TextInput(attrs={"placeholder": "usually blank, archaic"}))
#cave_slug = forms.CharField()
identified_login = forms.BooleanField(required=False,widget=forms.CheckboxInput(attrs={"onclick":"return false"})) # makes it readonly
who_are_you = forms.CharField(
widget=forms.TextInput(
attrs={"size": 100, "placeholder": "You are editing this page, who are you ? e.g. 'Becka' or 'Animal <mta@gasthof.expo>'",
@@ -119,7 +121,7 @@ class CaveForm(ModelForm):
field_order = ['unofficial_number', 'kataster_number', 'official_name', 'underground_description', 'survey',
'underground_centre_line', 'explorers', 'equipment', 'notes', 'references', 'description_file', 'survex_file',
'areacode', 'subarea', 'length', 'depth', 'extent',
'kataster_code', 'kataster_status', 'fully_explored', 'non_public', 'who_are_you']
'kataster_code', 'kataster_status', 'fully_explored', 'non_public', 'identified_login', 'who_are_you']
def clean_cave_slug(self):
if self.cleaned_data["cave_slug"] == "":
@@ -232,6 +234,7 @@ class EntranceForm(ModelForm):
)
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"}))
identified_login = forms.BooleanField(required=False,widget=forms.CheckboxInput(attrs={"onclick":"return false"})) # makes it readonly
who_are_you = forms.CharField(
widget=forms.TextInput(
attrs={"size": 100, "placeholder": "You are editing this page, who are you ? e.g. 'Becka' or 'Animal <mta@gasthof.expo>'",
@@ -241,7 +244,7 @@ class EntranceForm(ModelForm):
field_order = ['name', 'entrance_description', 'explorers', 'map_description', 'location_description', 'lastvisit', 'non_public',
'findability', 'marking', 'approach', 'underground_description', 'photo', 'marking_comment', 'findability_description', 'other_description',
'bearings', 'tag_station', 'other_station', 'easting', 'northing', 'lat_wgs84', 'long_wgs84', 'alt', 'who_are_you']
'bearings', 'tag_station', 'other_station', 'easting', 'northing', 'lat_wgs84', 'long_wgs84', 'alt', 'identified_login', 'who_are_you']
class Meta:
model = Entrance
@@ -274,6 +277,8 @@ class EntranceLetterForm(ModelForm):
to only one Cave.
see https://docs.djangoproject.com/en/5.1/topics/forms/modelforms/
To be re-written when we move the 'letter' field into Entrance
"""
# This only needs to be required=True for the second and subsequent entrances, not the first. Tricky.