summaryrefslogtreecommitdiff
path: root/docs/topics/forms
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-01-23 04:42:34 -0500
committerTim Graham <timograham@gmail.com>2013-01-23 04:50:24 -0500
commit2e6b0c5ca7265b3cee2ff68a9ef5d1865afb9a49 (patch)
treee9b4810f66887a1ce9e9cd02f8b3d9572b3e9736 /docs/topics/forms
parentf4132140f52c88b67d11743d4062a9d455959ffc (diff)
[1.5.x] Fixed #19610 - Added enctype note to forms topics doc.
Thanks will@ for the suggestion. Backport of 0de2645c00 from master
Diffstat (limited to 'docs/topics/forms')
-rw-r--r--docs/topics/forms/index.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt
index 9b5794a8f2..a3c17e1555 100644
--- a/docs/topics/forms/index.txt
+++ b/docs/topics/forms/index.txt
@@ -197,6 +197,14 @@ context variable ``form``. Here's a simple example template::
The form only outputs its own fields; it is up to you to provide the surrounding
``<form>`` tags and the submit button.
+If your form includes uploaded files, be sure to include
+``enctype="multipart/form-data"`` in the ``form`` element. If you wish to write
+a generic template that will work whether or not the form has files, you can
+use the :meth:`~django.forms.Form.is_multipart` attribute on the form::
+
+ <form action="/contact/" method="post"
+ {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
+
.. admonition:: Forms and Cross Site Request Forgery protection
Django ships with an easy-to-use :doc:`protection against Cross Site Request