mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-03-30 06:49:50 +01:00
make fields required
This commit is contained in:
@@ -288,6 +288,11 @@ class EntranceLetterForm(ModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class NewProspectForm(forms.Form):
|
class NewProspectForm(forms.Form):
|
||||||
|
"""
|
||||||
|
This is sufficient to create an entire HTML form automagically
|
||||||
|
in the Django template using {% for field in form %}.
|
||||||
|
This is where field labels, placeholder text and field validation are defined.
|
||||||
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
# If the form is bound (POSTed), update the field's value to uppercase
|
# If the form is bound (POSTed), update the field's value to uppercase
|
||||||
@@ -323,6 +328,7 @@ class NewProspectForm(forms.Form):
|
|||||||
date_found = forms.DateField(
|
date_found = forms.DateField(
|
||||||
label="Date Found (YYYY-MM-DD)",
|
label="Date Found (YYYY-MM-DD)",
|
||||||
input_formats=["%Y-%m-%d"],
|
input_formats=["%Y-%m-%d"],
|
||||||
|
required=True,
|
||||||
widget=forms.DateInput(attrs={
|
widget=forms.DateInput(attrs={
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholder": "2025-08-23",
|
"placeholder": "2025-08-23",
|
||||||
@@ -340,6 +346,7 @@ class NewProspectForm(forms.Form):
|
|||||||
)
|
)
|
||||||
identifier = forms.CharField(
|
identifier = forms.CharField(
|
||||||
label="New cave identifier",
|
label="New cave identifier",
|
||||||
|
required=True,
|
||||||
max_length=20,
|
max_length=20,
|
||||||
widget=forms.TextInput(attrs={
|
widget=forms.TextInput(attrs={
|
||||||
"placeholder": "2025-AB-01",
|
"placeholder": "2025-AB-01",
|
||||||
@@ -378,28 +385,26 @@ class NewProspectForm(forms.Form):
|
|||||||
)
|
)
|
||||||
|
|
||||||
discoverers = forms.CharField(
|
discoverers = forms.CharField(
|
||||||
label="Names of discoverers",
|
label="All the discoverers",
|
||||||
max_length=100,
|
max_length=100,
|
||||||
required=False,
|
required=True,
|
||||||
widget=forms.TextInput(attrs={
|
widget=forms.TextInput(attrs={
|
||||||
"placeholder": "Becka, Bill, Ted",
|
"placeholder": "Bill, Ted, Becka",
|
||||||
"size": 20,
|
"size": 20,
|
||||||
"style": "width: 20ch; min-width: 0;"
|
"style": "width: 20ch; min-width: 0;"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
who_are_you = forms.CharField(
|
who_are_you = forms.CharField(
|
||||||
label="Who are you",
|
label="Who are you",
|
||||||
max_length=100,
|
max_length=100,
|
||||||
required=False,
|
required=True,
|
||||||
widget=forms.TextInput(attrs={
|
widget=forms.TextInput(attrs={
|
||||||
"size": 100,
|
"size": 100,
|
||||||
"placeholder": "You are editing this page, who are you ? e.g. 'Becka' or 'Animal <mta@gasthof.expo>'",
|
"placeholder": "You are editing this page, who are you ? e.g. 'Becka' or 'Animal <mta@gasthof.expo>'",
|
||||||
"style": "width: 100ch; min-width: 0;"
|
"style": "width: 100ch; min-width: 0;"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
identified_login = forms.BooleanField(
|
identified_login = forms.BooleanField(
|
||||||
label="Identified login",
|
label="Identified login",
|
||||||
required=False,
|
required=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user