diff --git a/django/newforms/widgets.py b/django/newforms/widgets.py
index df5c20d97d..16e617301b 100644
--- a/django/newforms/widgets.py
+++ b/django/newforms/widgets.py
@@ -262,6 +262,11 @@ class FileInput(Input):
def value_from_datadict(self, data, files, name):
"File widgets take data from FILES, not POST"
return files.get(name, None)
+
+ def _has_changed(self, initial, data):
+ if data is None:
+ return False
+ return True
class Textarea(Widget):
def __init__(self, attrs=None):
diff --git a/tests/regressiontests/forms/widgets.py b/tests/regressiontests/forms/widgets.py
index 493cfa053c..4944a26b74 100644
--- a/tests/regressiontests/forms/widgets.py
+++ b/tests/regressiontests/forms/widgets.py
@@ -202,6 +202,30 @@ u''
>>> w.render('email', 'ŠĐĆŽćžšđ', attrs={'class': 'fun'})
u''
+Test for the behavior of _has_changed for FileInput. The value of data will
+more than likely come from request.FILES. The value of initial data will
+likely be a filename stored in the database. Since its value is of no use to
+a FileInput it is ignored.
+
+>>> w = FileInput()
+
+# No file was uploaded and no initial data.
+>>> w._has_changed(u'', None)
+False
+
+# A file was uploaded and no initial data.
+>>> w._has_changed(u'', {'filename': 'resume.txt', 'content': 'My resume'})
+True
+
+# A file was not uploaded, but there is initial data
+>>> w._has_changed(u'resume.txt', None)
+False
+
+# A file was uploaded and there is initial data (file identity is not dealt
+# with here)
+>>> w._has_changed('resume.txt', {'filename': 'resume.txt', 'content': 'My resume'})
+True
+
# Textarea Widget #############################################################
>>> w = Textarea()