summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-03-19 22:29:11 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-03-19 22:29:11 +0000
commit4457ba002d64d4a991b0561c5be69a8c61b2b828 (patch)
tree6251d21048f862d93fc9f011c40d3e63e87b46c5 /docs
parentbc1f67a6de45fe2ebfdf69ba449295066f365419 (diff)
Fixed #5894: added FilePathField to newforms. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/newforms.txt41
1 files changed, 37 insertions, 4 deletions
diff --git a/docs/newforms.txt b/docs/newforms.txt
index ff66f40e41..26dde439ef 100644
--- a/docs/newforms.txt
+++ b/docs/newforms.txt
@@ -1333,13 +1333,14 @@ given length.
An ``UploadedFile`` object has two attributes:
- ====================== =====================================================
- Argument Description
- ====================== =====================================================
+ ====================== ====================================================
+ Attribute Description
+ ====================== ====================================================
``filename`` The name of the file, provided by the uploading
client.
+
``content`` The array of bytes comprising the file content.
- ====================== =====================================================
+ ====================== ====================================================
The string representation of an ``UploadedFile`` is the same as the filename
attribute.
@@ -1349,6 +1350,38 @@ When you use a ``FileField`` on a form, you must also remember to
.. _`bind the file data to the form`: `Binding uploaded files to a form`_
+``FilePathField``
+~~~~~~~~~~~~~~~~~
+
+**New in Django development version**
+
+ * Default widget: ``Select``
+ * Empty value: ``None``
+ * Normalizes to: A unicode object
+ * Validates that the selected choice exists in the list of choices.
+ * Error message keys: ``required``, ``invalid_choice``
+
+The field allows choosing from files inside a certain directory. It takes three
+extra arguments:
+
+ ============== ========== ===============================================
+ Argument Required? Description
+ ============== ========== ===============================================
+ ``path`` Yes The absolute path to the directory whose
+ contents you want listed. This directory must
+ exist.
+
+ ``recursive`` No If ``False`` (the default) only the direct
+ contents of ``path`` will be offered as choices.
+ If ``True``, the directory will be descended
+ into recursively and all descendants will be
+ listed as choices.
+
+ ``match`` No A regular expression pattern; only files with
+ names matching this expression will be allowed
+ as choices.
+ ============== ========== ===============================================
+
``ImageField``
~~~~~~~~~~~~~~