From d9c083cfee853272ded14c6c87623e910c9e81c4 Mon Sep 17 00:00:00 2001 From: Alex Hill Date: Thu, 1 Sep 2016 13:18:41 +0800 Subject: Refs #27039 -- Fixed regression with field defaults in prefixed forms. --- django/forms/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/forms') diff --git a/django/forms/models.py b/django/forms/models.py index 628d96b237..ff6b2f0251 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -54,7 +54,7 @@ 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 f.name not in form.data and + 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)): continue # Defer saving file-type fields until after the other fields, so a -- cgit v1.3