1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +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

@@ -387,6 +387,9 @@ class FileInput(Input):
def value_omitted_from_data(self, data, files, name):
return name not in files
def use_required_attribute(self, initial):
return super().use_required_attribute(initial) and not initial
FILE_INPUT_CONTRADICTION = object()
@@ -451,9 +454,6 @@ class ClearableFileInput(FileInput):
return False
return upload
def use_required_attribute(self, initial):
return super().use_required_attribute(initial) and not initial
def value_omitted_from_data(self, data, files, name):
return (
super().value_omitted_from_data(data, files, name) and