Ticket #15055: django15055.formsdocs.diff

File django15055.formsdocs.diff, 1.1 KB (added by Bas Peschier, 14 years ago)
  • docs/topics/forms/index.txt

     
    173173context variable ``form``. Here's a simple example template::
    174174
    175175    <form action="/contact/" method="post">
     176    {% csrf_token %}
    176177    {{ form.as_p }}
    177178    <input type="submit" value="Submit" />
    178179    </form>
     
    180181The form only outputs its own fields; it is up to you to provide the surrounding
    181182``<form>`` tags and the submit button.
    182183
     184.. admonition:: Forms and Cross Site Request Forgery protection
     185
     186   Django ships with an easy-to-use :doc:`protection against Cross Site Request
     187   Forgeries </ref/contrib/csrf>` in forms. This protection is manifested by
     188   the :ttag:`crsf_token` template tag in this example. For sake of purely
     189   explaining using forms in templates, this tag is not displayed in further
     190   examples in this document.
     191
    183192``form.as_p`` will output the form with each form field and accompanying label
    184193wrapped in a paragraph. Here's the output for our example template::
    185194
Back to Top