#27805 closed Bug (fixed)
ClearableFileInput's "Clear" checkbox on model fields with a default doesn't work
Reported by: | Mario J. Barchéin Molina | Owned by: | Tim Graham |
---|---|---|---|
Component: | Forms | Version: | 1.10 |
Severity: | Release blocker | Keywords: | FileField, ModelForm, ClearableFileInput |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Checking 'clear' in a FileField and saving the ModelForm doesn't set None in model's attribute.
This is broken from 1.10.2 to 1.10.x and 1.11a1. Works in 1.9.x and 1.10.1
I attach a simple project "polls" with only one model (TestModel) and admin zone. To reproduce the problem:
1) Log in in admin zone in http://localhost:8000/admin/polls/testmodel/ with user "admin" and password "adminadmin"
2) Create a new "Test Model" with an image
3) Edit the created "Test Model" instance, check "clear" checkbox and submit form
The expected behaviour is having model with no image but this doesn't happen.
Attachments (1)
Change History (6)
by , 8 years ago
Attachment: | testproject.tar.gz added |
---|
comment:1 by , 8 years ago
Component: | Uncategorized → Forms |
---|---|
Owner: | changed from | to
Severity: | Normal → Release blocker |
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:2 by , 8 years ago
Has patch: | set |
---|---|
Summary: | clear checkbox in FileField doesn't work → ClearableFileInput's "Clear" checkbox on model fields with a default doesn't work |
I'm not sure if default=None
is accomplishing anything for your use case, but removing it would solve the issue until the fix is released.
test project with sqlite database