You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django form field has a property that can be set in constructor:
# show_hidden_initial -- Boolean that specifies if it is needed to render a
# hidden widget with initial value after widget.
When bound field is rendered by Django, it is used to append a hidden field containing the default value:
def__str__(self):
"""Render this field as an HTML widget."""ifself.field.show_hidden_initial:
returnself.as_widget() +self.as_hidden(only_initial=True)
returnself.as_widget()
However, when rendering form using FieldRenderer, this functionality is broken. As a result, form's changed_values contains the field even if it was not actually changed by user (assuming it already has a value)
The linked Pull Request fixes the issue for me in django 2.2. I have not tested other Django versions, but show_hidden_initial and implementetion of field render is the same in Django 2.2 and 3.2, so the fix should work for all supported versions of Django.
Django form field has a property that can be set in constructor:
When bound field is rendered by Django, it is used to append a hidden field containing the default value:
However, when rendering form using
FieldRenderer
, this functionality is broken. As a result, form'schanged_values
contains the field even if it was not actually changed by user (assuming it already has a value)Affected versions:
Django 2.2.23
django-bootstrap3 15.0.0
The text was updated successfully, but these errors were encountered: