fixed bug with data-initial-value of 0

This commit is contained in:
David Kennedy 2025-03-21 05:42:11 -04:00
parent 1fa307dd7e
commit 0ad4f2b84f
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B

View file

@ -175,7 +175,7 @@ def input_with_errors(context, field=None): # noqa: C901
# Conditionally add the data-initial-value attribute
if context.get("add_initial_value_attr", False):
attrs["data-initial-value"] = field.initial or ""
attrs["data-initial-value"] = field.initial if field.initial is not None else ""
# ask Django to give us the widget dict
# see Widget.get_context() on