diff options
| author | Tim Graham <timograham@gmail.com> | 2017-02-03 11:11:39 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-06 21:10:44 -0500 |
| commit | cd69ac06d6e415f74e9566aa6473e8b577e29074 (patch) | |
| tree | 730422d501e2c143b1192f9c820a348bc272d98a /django/forms | |
| parent | 82e316ea54b135dc5621a8625c5e38398ad38571 (diff) | |
[1.10.x] Fixed #27805 -- Fixed ClearableFileInput's "Clear" checkbox on model fields with a default.
Backport of 4353640ea9495d58fabd0357253b82de3b069408 from master
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/widgets.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 1d5fabe064..179341636c 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -440,6 +440,12 @@ class ClearableFileInput(FileInput): def use_required_attribute(self, initial): return super(ClearableFileInput, self).use_required_attribute(initial) and not initial + def value_omitted_from_data(self, data, files, name): + return ( + super(ClearableFileInput, self).value_omitted_from_data(data, files, name) and + self.clear_checkbox_name(name) not in data + ) + class Textarea(Widget): def __init__(self, attrs=None): |
