Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#27232 closed Bug (duplicate)

Regression in construct_instance for FileField's with defaults

Reported by: ryanbutterfield Owned by: nobody
Component: Forms Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


Django 1.10 has added a regression in construct_instance in relation to FileField's with a default value (or any field that uses form.files).

This was added in and a separate regression fixed in

The new code only checks for form.add_prefix( not in FileField's have their values in form.files and not in, so this causes FileField's to be skipped if f.has_default() is True.

The correct code should be along the lines of:

 if (f.has_default() and 
                  form.add_prefix( not in and
                  form.add_prefix( not in form.files and
                  not getattr(form[].field.widget, 'dont_use_model_field_default_for_empty_data', False)):

Change History (1)

comment:1 Changed 3 years ago by Simon Charette

Resolution: duplicate
Status: newclosed

Duplicate of #27186, should be fixed in Django 1.10.2 by this patch.

Last edited 3 years ago by Tim Graham (previous) (diff)
Note: See TracTickets for help on using tickets.
Back to Top