From 9ca6192916b55c4e011d646924095d98a2981787 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 22 Jan 2025 10:03:48 -0500 Subject: [PATCH 1/2] Only set CheckboxInputField for BooleanFields --- corehq/apps/domain/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corehq/apps/domain/forms.py b/corehq/apps/domain/forms.py index 68584dbbd973..c3af0c63454e 100644 --- a/corehq/apps/domain/forms.py +++ b/corehq/apps/domain/forms.py @@ -952,7 +952,7 @@ def __init__(self, *args, **kwargs): excluded_fields.append('secure_sessions_timeout') for field in self.fields.values(): - if not isinstance(field.widget, BootstrapCheckboxInput): + if isinstance(field, BooleanField): field.widget = BootstrapCheckboxInput() fields = [hqcrispy.CheckboxField(field_name) From c6a80bd12dc2e510acc9e38e445e99f173444a6f Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 22 Jan 2025 11:31:37 -0500 Subject: [PATCH 2/2] Preserve custom BootstrapCheckboxInput widgets --- corehq/apps/domain/forms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/corehq/apps/domain/forms.py b/corehq/apps/domain/forms.py index c3af0c63454e..124a01b7b0a7 100644 --- a/corehq/apps/domain/forms.py +++ b/corehq/apps/domain/forms.py @@ -952,7 +952,8 @@ def __init__(self, *args, **kwargs): excluded_fields.append('secure_sessions_timeout') for field in self.fields.values(): - if isinstance(field, BooleanField): + has_custom_input = isinstance(field.widget, BootstrapCheckboxInput) + if isinstance(field, BooleanField) and not has_custom_input: field.widget = BootstrapCheckboxInput() fields = [hqcrispy.CheckboxField(field_name)