diff options
| author | Tim Graham <timograham@gmail.com> | 2016-09-06 17:41:54 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-22 12:20:58 -0400 |
| commit | 3507d4e773aa9ff2336e7230ba231c4ba6eb568f (patch) | |
| tree | 09467b4724131e91b0afe1d2f133e5e56ba068cf /django/forms/models.py | |
| parent | 92323d54fd6df077dc523c423c7bb2dd8dbde621 (diff) | |
Fixed #27186 -- Fixed model form default fallback for MultiWidget, FileInput, SplitDateTimeWidget, SelectDateWidget, and SplitArrayWidget.
Thanks Matt Westcott for the review.
Diffstat (limited to 'django/forms/models.py')
| -rw-r--r-- | django/forms/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py index f44ce33f65..3fadc2e3b5 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -54,8 +54,8 @@ def construct_instance(form, instance, fields=None, exclude=None): continue # Leave defaults for fields that aren't in POST data, except for # checkbox inputs because they don't appear in POST data if not checked. - if (f.has_default() and form.add_prefix(f.name) not in form.data and - not getattr(form[f.name].field.widget, 'dont_use_model_field_default_for_empty_data', False)): + if (f.has_default() and + form[f.name].field.widget.value_omitted_from_data(form.data, form.files, form.add_prefix(f.name))): continue # Defer saving file-type fields until after the other fields, so a # callable upload_to can use the values from other fields. |
