Skip to content
Snippets Groups Projects
Commit 3895a173 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add documentation about the multifile input

parent 228512cb
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,17 @@ from django.forms import FileInput, FileField ...@@ -2,12 +2,17 @@ from django.forms import FileInput, FileField
class MultiFileInput(FileInput): class MultiFileInput(FileInput):
"""
File Input only returns one file from its clean method.
This passes all files through the clean method and means we have a list of
files available for post processing
"""
def __init__(self, *args, attrs={}, **kwargs): def __init__(self, *args, attrs={}, **kwargs):
attrs['multiple'] = True attrs['multiple'] = True
super().__init__(*args, attrs=attrs, **kwargs) super().__init__(*args, attrs=attrs, **kwargs)
def value_from_datadict(self, data, files, name): def value_from_datadict(self, data, files, name):
"File widgets take data from FILES, not POST"
return files.getlist(name) return files.getlist(name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment