diff options
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/boundfield.py | 8 | ||||
| -rw-r--r-- | django/forms/fields.py | 6 |
2 files changed, 3 insertions, 11 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index 27e80c65e7..d0ddd9715b 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -79,12 +79,9 @@ class BoundField: attributes passed as attrs. If a widget isn't specified, use the field's default widget. """ - if not widget: - widget = self.field.widget - + widget = widget or self.field.widget if self.field.localize: widget.is_localized = True - attrs = attrs or {} attrs = self.build_widget_attrs(attrs, widget) if self.auto_id and 'id' not in widget.attrs: @@ -219,8 +216,7 @@ class BoundField: return data def build_widget_attrs(self, attrs, widget=None): - if not widget: - widget = self.field.widget + widget = widget or self.field.widget attrs = dict(attrs) # Copy attrs to avoid modifying the argument. if widget.use_required_attribute(self.initial) and self.field.required and self.form.use_required_attribute: attrs['required'] = True diff --git a/django/forms/fields.py b/django/forms/fields.py index 61f5ccfe58..2019a43c73 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -591,11 +591,7 @@ class FileField(Field): return data def has_changed(self, initial, data): - if self.disabled: - return False - if data is None: - return False - return True + return not self.disabled and data is not None class ImageField(FileField): |
