forms.Widget.value_omitted_from_data()

value_omitted_from_data(data, files, name) [source]

New in Django 1.10.2.

Given data and files dictionaries and this widget’s name, returns whether or not there’s data or files for the widget.

The method’s result affects whether or not a field in a model form falls back to its default.

Special cases are CheckboxInput and CheckboxSelectMultiple, which always return False because an unchecked checkbox doesn’t appear in the data of an HTML form submission, so it’s unknown whether or not the user actually submitted a value.

doc_Django
2016-10-09 18:37:13
Comments
Leave a Comment

Please login to continue.