Opened 21 months ago
Last modified 9 months ago
#34488 closed Cleanup/optimization
ClearableFileInput widget forgets "Clear" selection when form is not valid — at Version 2
Reported by: | bmihelac | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 4.1 |
Severity: | Normal | Keywords: | admin, forms, ClearableFileInput |
Cc: | Marcelo Galigniana | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
ClearableFileInput widget forgets "Clear" selection when form is not valid, that causes file would not be deleted once when form is valid again. This can be inconvinient, especially for forms with many fields.
To reproduce:
- Choose admin for any model instance where attachment is not required and has some validation,
- check "Clear" next to the attachment, and change the form, so validation would fail,
- Save form, validation error would occur, attachment and "Clear" would be empty
- make form valid again and Save, attachment woult not be cleared
(I am attaching example screenshots)
https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-before.png
https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-validation-error.png
https://code.djangoproject.com/attachment/ticket/34488/clearable-file-input-validation-success.png
Change History (6)
comment:1 by , 21 months ago
Description: | modified (diff) |
---|
comment:2 by , 21 months ago
Description: | modified (diff) |
---|
by , 21 months ago
Attachment: | clearable-file-input-before.png added |
---|
by , 21 months ago
Attachment: | clearable-file-input-validation-error.2.png added |
---|
by , 21 months ago
Attachment: | clearable-file-input-validation-error.png added |
---|
validation error occurs (ClearableFileInput has no file and has no Clear checkbox)
by , 21 months ago
Attachment: | clearable-file-input-validation-success.png added |
---|
File is not removed after successful validation and saving
initial state