Fixed #13584 -- Optionally allow empty files with django.forms.FileField. Thanks for the patch erickr and closedbracket.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16090 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Chris Beaven 2011-04-22 21:18:27 +00:00
parent c77372cad0
commit 534c427b20
3 changed files with 13 additions and 2 deletions

View file

@ -503,10 +503,15 @@ given length.
* Empty value: ``None``
* Normalizes to: An ``UploadedFile`` object that wraps the file content
and file name into a single object.
* Validates that non-empty file data has been bound to the form.
* Can validate that non-empty file data has been bound to the form.
* Error message keys: ``required``, ``invalid``, ``missing``, ``empty``,
``max_length``
Has two optional arguments for validation, ''max_length'' and
''allow_empty_file''. If provided, these ensure that the file name is at
most the given length, and that validation will succeed even if the file
content is empty.
To learn more about the ``UploadedFile`` object, see the :doc:`file uploads
documentation </topics/http/file-uploads>`.