diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/forms.py | 4 | ||||
-rw-r--r-- | core/views/caves.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/forms.py b/core/forms.py index 24beee4..5cbbe95 100644 --- a/core/forms.py +++ b/core/forms.py @@ -208,7 +208,9 @@ class EntranceLetterForm(ModelForm): Nb. The relationship between caves and entrances has historically been a many to many relationship. With entrances gaining new caves and letters when caves are joined. """ - entranceletter = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "2"})) + + # This only needs to be required=True for the second and subsequent entrances, not the first. Tricky. + entranceletter = forms.CharField(required=True, widget=forms.TextInput(attrs={"size": "2"})) class Meta: model = CaveAndEntrance diff --git a/core/views/caves.py b/core/views/caves.py index c845f01..adb3398 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -519,7 +519,7 @@ def edit_entrance(request, path="", caveslug=None, entslug=None): entranceletter = entletterform.cleaned_data["entranceletter"] else: print(f"- POST INVALID {caveslug=} {entslug=} {path=} entletterform invalid.") - return render(request, "errors/badslug.html", {"entletter problem in edit_entrances()"}) + return render(request, "errors/badslug.html", {"badslug": "entletter problem in edit_entrances()"}) # if entform.is_valid() and entletterform.is_valid(): if entform.is_valid(): entrance = entform.save(commit=False) |