Opened 5 years ago
Closed 5 years ago
#31118 closed Cleanup/optimization (fixed)
FileInput shouldn't display required attribute when initial data exists.
Reported by: | thenewguy | Owned by: | shubham singh |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Jon Dufresne, shubham singh | 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 )
I think that ClearableFileInput.use_required_attribute()
(https://github.com/django/django/blob/e703b93a656b78b9b444bb3a9980e305ed002a70/django/forms/widgets.py#L454) should be moved to FileInput.use_required_attribute()
so that required
is not output on the html input element that represents FileInput
when a file is already set (e.g. already saved on a model instance that is being edited).
Maybe I am overlooking a use case where this is not desirable? I can not think of one.
Change History (8)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
comment:2 by , 5 years ago
comment:3 by , 5 years ago
Cc: | added |
---|---|
Component: | Uncategorized → Forms |
Summary: | FileInput widget and use_required_attribute() → FileInput shouldn't display required attribute when initial data exists. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
Version: | 3.0 → master |
comment:4 by , 5 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:6 by , 5 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
comment:7 by , 5 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
This might explain better:
If the
use_required_attribute()
method is copied fromClearableFileInput
toFileInput
this passes. This seems like more appropriate behavior to me