Ticket #19610: 19610.diff

File 19610.diff, 1.4 KB (added by Tim Graham, 5 years ago)
  • docs/ref/forms/api.txt

    diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
    index 4aacbf0..d1f877f 100644
    a b form data *and* file data:: 
    716716Testing for multipart forms
     719.. method:: Form.is_multipart
    719721If you're writing reusable views or templates, you may not know ahead of time
    720722whether your form is a multipart form or not. The ``is_multipart()`` method
    721723tells you whether the form requires multipart encoding for submission::
  • docs/topics/forms/index.txt

    diff --git a/docs/topics/forms/index.txt b/docs/topics/forms/index.txt
    index 9b5794a..a3c17e1 100644
    a b context variable ``form``. Here's a simple example template:: 
    197197The form only outputs its own fields; it is up to you to provide the surrounding
    198198``<form>`` tags and the submit button.
     200If your form includes uploaded files, be sure to include
     201``enctype="multipart/form-data"`` in the ``form`` element. If you wish to write
     202a generic template that will work whether or not the form has files, you can
     203use the :meth:`~django.forms.Form.is_multipart` attribute on the form::
     205    <form action="/contact/" method="post"
     206        {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
    200208.. admonition:: Forms and Cross Site Request Forgery protection
    202210   Django ships with an easy-to-use :doc:`protection against Cross Site Request
Back to Top