diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-11-05 15:20:45 +0200 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-11-05 15:20:45 +0200 |
commit | 2c673514240d93c5a4431c98f87aafecb94bc081 (patch) | |
tree | 81052fc5b936ffee9061bdf8278b3a30070848b3 /core | |
parent | d524f94c478612da93fa6b66cd65e4cb3a26ec0b (diff) | |
download | troggle-2c673514240d93c5a4431c98f87aafecb94bc081.tar.gz troggle-2c673514240d93c5a4431c98f87aafecb94bc081.tar.bz2 troggle-2c673514240d93c5a4431c98f87aafecb94bc081.zip |
bugfix and making more robust
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) |