1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #31118 -- Made FileInput to avoid the required attribute when initial data exists.

This commit is contained in:
Shubham singh
2020-01-05 13:21:33 +05:30
committed by Mariusz Felisiak
parent 53d8646f79
commit ffcf1a8ebf
5 changed files with 46 additions and 13 deletions

View File

@@ -18,3 +18,9 @@ class FileInputTest(WidgetTest):
def test_value_omitted_from_data(self):
self.assertIs(self.widget.value_omitted_from_data({}, {}, 'field'), True)
self.assertIs(self.widget.value_omitted_from_data({}, {'field': 'value'}, 'field'), False)
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)