apply correct default club_status when GET data is missing

This commit is contained in:
imperosol
2026-04-01 14:04:10 +02:00
parent 0f00c91b59
commit dfe884484d
2 changed files with 8 additions and 3 deletions

View File

@@ -331,6 +331,11 @@ class ClubSearchForm(forms.ModelForm):
initial=True,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __init__(self, *args, data: dict | None = None, **kwargs):
super().__init__(*args, data=data, **kwargs)
if data is not None and "club_status" not in data:
# if the key is missing, it is considered as None,
# even though we want the default True value to be applied in such a case
# so we enforce it.
self.fields["club_status"].value = True
self.fields["name"].required = False