﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34143	Multiple file upload docs	Guillaume LEBRETON	nobody	"In the docs, https://docs.djangoproject.com/en/dev/topics/http/file-uploads/#uploading-multiple-files
there is this code snippet: 

{{{
def post(self, request, *args, **kwargs):
        form_class = self.get_form_class()
        form = self.get_form(form_class)
        files = request.FILES.getlist('file_field')
        if form.is_valid():
            for f in files:
                ...  # Do something with each file.
            return self.form_valid(form)
        else:
            return self.form_invalid(form)
}}}
I think it's a bit confusing to use form validation and then get the file list directly from the request. 
I found that replacing {{{ files = request.FILES.getlist('file_field') }}} by {{{ files = form.files.getlist('file_field') }}} seems to be more consistent with the usual django form approach.

The best approach would be to access {{{ file_field }}} from cleaned_data but it's not really possible with multple files for now."	Uncategorized	new	Uncategorized	4.1	Normal				Unreviewed	0	0	0	0	0	0
