ensure proper data type for comparison
All checks were successful
Tests / test (push) Successful in 28s

This commit is contained in:
Tobias Brunner 2025-12-05 10:13:39 +01:00
parent 903987796f
commit e1aa9015f2
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ

View file

@ -357,6 +357,16 @@ class CustomFormMixin(FormGeneratorMixin):
max_val = field_config.get("max_value")
unit = field_config.get("addon_text")
if not isinstance(field, forms.IntegerField):
widget = field.widget
self.fields[field_name] = forms.IntegerField(
label=field.label,
help_text=field.help_text,
required=field.required,
widget=widget,
)
field = self.fields[field_name]
if unit:
field.widget = NumberInputWithAddon(addon_text=unit)
field.addon_text = unit