1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

[1.10.x] Fixed #27037 -- Prevented required attribute on ClearableFileInput when initial data exists.

Backport of fab46ce6f5 from master
This commit is contained in:
Jon Dufresne
2016-08-12 10:59:01 -07:00
committed by Tim Graham
parent 13fd711f10
commit d8cda352b1
8 changed files with 66 additions and 18 deletions

View File

@@ -143,3 +143,9 @@ class ClearableFileInputTest(WidgetTest):
html = self.widget.render('myfile', NoURLFieldFile())
self.assertHTMLEqual(html, '<input name="myfile" type="file" />')
def test_use_required_attribute(self):
# False when initial data exists. The file input is left blank by the
# user to keep the existing, initial value.
self.assertIs(self.widget.use_required_attribute(None), True)
self.assertIs(self.widget.use_required_attribute('resume.txt'), False)