2008-08-24 06:25:40 +08:00
|
|
|
==================
|
|
|
|
Working with forms
|
|
|
|
==================
|
|
|
|
|
|
|
|
.. admonition:: About this document
|
|
|
|
|
|
|
|
This document provides an introduction to Django's form handling features.
|
2010-10-10 15:08:35 +08:00
|
|
|
For a more detailed look at specific areas of the forms API, see
|
|
|
|
:doc:`/ref/forms/api`, :doc:`/ref/forms/fields`, and
|
|
|
|
:doc:`/ref/forms/validation`.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
2008-09-09 09:54:20 +08:00
|
|
|
.. highlightlang:: html+django
|
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
``django.forms`` is Django's form-handling library.
|
|
|
|
|
|
|
|
While it is possible to process form submissions just using Django's
|
|
|
|
:class:`~django.http.HttpRequest` class, using the form library takes care of a
|
|
|
|
number of common form-related tasks. Using it, you can:
|
|
|
|
|
|
|
|
1. Display an HTML form with automatically generated form widgets.
|
2009-05-18 02:10:10 +08:00
|
|
|
2. Check submitted data against a set of validation rules.
|
|
|
|
3. Redisplay a form in the case of validation errors.
|
|
|
|
4. Convert submitted form data to the relevant Python data types.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
Overview
|
|
|
|
========
|
|
|
|
|
|
|
|
The library deals with these concepts:
|
|
|
|
|
|
|
|
.. glossary::
|
|
|
|
|
|
|
|
Widget
|
|
|
|
A class that corresponds to an HTML form widget, e.g.
|
|
|
|
``<input type="text">`` or ``<textarea>``. This handles rendering of the
|
|
|
|
widget as HTML.
|
|
|
|
|
|
|
|
Field
|
|
|
|
A class that is responsible for doing validation, e.g.
|
2011-04-02 00:10:22 +08:00
|
|
|
an ``EmailField`` that makes sure its data is a valid email address.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
Form
|
|
|
|
A collection of fields that knows how to validate itself and
|
|
|
|
display itself as HTML.
|
|
|
|
|
|
|
|
Form Media
|
|
|
|
The CSS and JavaScript resources that are required to render a form.
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
The library is decoupled from the other Django components, such as the database
|
|
|
|
layer, views and templates. It relies only on Django settings, a couple of
|
|
|
|
``django.utils`` helper functions and Django's internationalization hooks (but
|
|
|
|
you're not required to be using internationalization features to use this
|
|
|
|
library).
|
|
|
|
|
|
|
|
Form objects
|
|
|
|
============
|
|
|
|
|
|
|
|
A Form object encapsulates a sequence of form fields and a collection of
|
|
|
|
validation rules that must be fulfilled in order for the form to be accepted.
|
2009-02-22 14:09:03 +08:00
|
|
|
Form classes are created as subclasses of ``django.forms.Form`` and
|
2008-08-24 06:25:40 +08:00
|
|
|
make use of a declarative style that you'll be familiar with if you've used
|
|
|
|
Django's database models.
|
|
|
|
|
|
|
|
For example, consider a form used to implement "contact me" functionality on a
|
2008-09-09 09:54:20 +08:00
|
|
|
personal Web site:
|
|
|
|
|
|
|
|
.. code-block:: python
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
from django import forms
|
|
|
|
|
|
|
|
class ContactForm(forms.Form):
|
|
|
|
subject = forms.CharField(max_length=100)
|
|
|
|
message = forms.CharField()
|
|
|
|
sender = forms.EmailField()
|
|
|
|
cc_myself = forms.BooleanField(required=False)
|
|
|
|
|
|
|
|
A form is composed of ``Field`` objects. In this case, our form has four
|
|
|
|
fields: ``subject``, ``message``, ``sender`` and ``cc_myself``. ``CharField``,
|
|
|
|
``EmailField`` and ``BooleanField`` are just three of the available field types;
|
2010-08-20 03:27:44 +08:00
|
|
|
a full list can be found in :doc:`/ref/forms/fields`.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
If your form is going to be used to directly add or edit a Django model, you can
|
2010-08-20 03:27:44 +08:00
|
|
|
use a :doc:`ModelForm </topics/forms/modelforms>` to avoid duplicating your model
|
2008-08-24 06:25:40 +08:00
|
|
|
description.
|
|
|
|
|
|
|
|
Using a form in a view
|
|
|
|
----------------------
|
|
|
|
|
2008-09-09 09:54:20 +08:00
|
|
|
The standard pattern for processing a form in a view looks like this:
|
|
|
|
|
|
|
|
.. code-block:: python
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
def contact(request):
|
|
|
|
if request.method == 'POST': # If the form has been submitted...
|
|
|
|
form = ContactForm(request.POST) # A form bound to the POST data
|
|
|
|
if form.is_valid(): # All validation rules pass
|
|
|
|
# Process the data in form.cleaned_data
|
|
|
|
# ...
|
|
|
|
return HttpResponseRedirect('/thanks/') # Redirect after POST
|
|
|
|
else:
|
|
|
|
form = ContactForm() # An unbound form
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
return render_to_response('contact.html', {
|
|
|
|
'form': form,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
There are three code paths here:
|
|
|
|
|
|
|
|
1. If the form has not been submitted, an unbound instance of ContactForm is
|
|
|
|
created and passed to the template.
|
|
|
|
2. If the form has been submitted, a bound instance of the form is created
|
|
|
|
using ``request.POST``. If the submitted data is valid, it is processed
|
|
|
|
and the user is re-directed to a "thanks" page.
|
|
|
|
3. If the form has been submitted but is invalid, the bound form instance is
|
|
|
|
passed on to the template.
|
|
|
|
|
|
|
|
The distinction between **bound** and **unbound** forms is important. An unbound
|
|
|
|
form does not have any data associated with it; when rendered to the user, it
|
|
|
|
will be empty or will contain default values. A bound form does have submitted
|
|
|
|
data, and hence can be used to tell if that data is valid. If an invalid bound
|
|
|
|
form is rendered it can include inline error messages telling the user where
|
|
|
|
they went wrong.
|
|
|
|
|
|
|
|
See :ref:`ref-forms-api-bound-unbound` for further information on the
|
|
|
|
differences between bound and unbound forms.
|
|
|
|
|
2009-05-24 14:46:02 +08:00
|
|
|
Handling file uploads with a form
|
|
|
|
---------------------------------
|
|
|
|
|
|
|
|
To see how to handle file uploads with your form see
|
|
|
|
:ref:`binding-uploaded-files` for more information.
|
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
Processing the data from a form
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
Once ``is_valid()`` returns ``True``, you can process the form submission safe
|
|
|
|
in the knowledge that it conforms to the validation rules defined by your form.
|
|
|
|
While you could access ``request.POST`` directly at this point, it is better to
|
|
|
|
access ``form.cleaned_data``. This data has not only been validated but will
|
|
|
|
also be converted in to the relevant Python types for you. In the above example,
|
|
|
|
``cc_myself`` will be a boolean value. Likewise, fields such as ``IntegerField``
|
2010-12-27 05:50:16 +08:00
|
|
|
and ``FloatField`` convert values to a Python int and float respectively. Note
|
|
|
|
that read-only fields are not available in ``form.cleaned_data`` (and setting
|
|
|
|
a value in a custom ``clean()`` method won't have any effect) because these
|
|
|
|
fields are displayed as text rather than as input elements, and thus are not
|
|
|
|
posted back to the server.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
2008-09-09 09:54:20 +08:00
|
|
|
Extending the above example, here's how the form data could be processed:
|
|
|
|
|
|
|
|
.. code-block:: python
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
if form.is_valid():
|
|
|
|
subject = form.cleaned_data['subject']
|
|
|
|
message = form.cleaned_data['message']
|
|
|
|
sender = form.cleaned_data['sender']
|
|
|
|
cc_myself = form.cleaned_data['cc_myself']
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
recipients = ['info@example.com']
|
|
|
|
if cc_myself:
|
|
|
|
recipients.append(sender)
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
from django.core.mail import send_mail
|
|
|
|
send_mail(subject, message, sender, recipients)
|
|
|
|
return HttpResponseRedirect('/thanks/') # Redirect after POST
|
|
|
|
|
2011-04-02 00:10:22 +08:00
|
|
|
For more on sending email from Django, see :doc:`/topics/email`.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
Displaying a form using a template
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
Forms are designed to work with the Django template language. In the above
|
|
|
|
example, we passed our ``ContactForm`` instance to the template using the
|
|
|
|
context variable ``form``. Here's a simple example template::
|
|
|
|
|
2011-02-08 06:52:39 +08:00
|
|
|
<form action="/contact/" method="post">{% csrf_token %}
|
2008-08-24 06:25:40 +08:00
|
|
|
{{ form.as_p }}
|
2008-09-15 20:14:31 +08:00
|
|
|
<input type="submit" value="Submit" />
|
2008-08-24 06:25:40 +08:00
|
|
|
</form>
|
|
|
|
|
|
|
|
The form only outputs its own fields; it is up to you to provide the surrounding
|
|
|
|
``<form>`` tags and the submit button.
|
|
|
|
|
2011-02-08 06:52:39 +08:00
|
|
|
.. admonition:: Forms and Cross Site Request Forgery protection
|
|
|
|
|
|
|
|
Django ships with an easy-to-use :doc:`protection against Cross Site Request
|
|
|
|
Forgeries </ref/contrib/csrf>`. When submitting a form via POST with
|
|
|
|
CSRF protection enabled you must use the :ttag:`csrf_token` template tag
|
|
|
|
as in the preceding example. However, since CSRF protection is not
|
|
|
|
directly tied to forms in templates, this tag is omitted from the
|
|
|
|
following examples in this document.
|
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
``form.as_p`` will output the form with each form field and accompanying label
|
|
|
|
wrapped in a paragraph. Here's the output for our example template::
|
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/contact/" method="post">
|
2008-08-24 06:25:40 +08:00
|
|
|
<p><label for="id_subject">Subject:</label>
|
|
|
|
<input id="id_subject" type="text" name="subject" maxlength="100" /></p>
|
|
|
|
<p><label for="id_message">Message:</label>
|
|
|
|
<input type="text" name="message" id="id_message" /></p>
|
|
|
|
<p><label for="id_sender">Sender:</label>
|
|
|
|
<input type="text" name="sender" id="id_sender" /></p>
|
|
|
|
<p><label for="id_cc_myself">Cc myself:</label>
|
|
|
|
<input type="checkbox" name="cc_myself" id="id_cc_myself" /></p>
|
2008-09-15 20:14:31 +08:00
|
|
|
<input type="submit" value="Submit" />
|
2008-08-24 06:25:40 +08:00
|
|
|
</form>
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
Note that each form field has an ID attribute set to ``id_<field-name>``, which
|
|
|
|
is referenced by the accompanying label tag. This is important for ensuring
|
|
|
|
forms are accessible to assistive technology such as screen reader software. You
|
|
|
|
can also :ref:`customize the way in which labels and ids are generated
|
|
|
|
<ref-forms-api-configuring-label>`.
|
|
|
|
|
|
|
|
You can also use ``form.as_table`` to output table rows (you'll need to provide
|
2008-09-03 12:40:52 +08:00
|
|
|
your own ``<table>`` tags) and ``form.as_ul`` to output list items.
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
Customizing the form template
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
If the default generated HTML is not to your taste, you can completely customize
|
|
|
|
the way a form is presented using the Django template language. Extending the
|
|
|
|
above example::
|
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/contact/" method="post">
|
2010-10-09 07:32:46 +08:00
|
|
|
{{ form.non_field_errors }}
|
2008-08-24 06:25:40 +08:00
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ form.subject.errors }}
|
2011-04-02 00:10:22 +08:00
|
|
|
<label for="id_subject">Email subject:</label>
|
2008-08-24 06:25:40 +08:00
|
|
|
{{ form.subject }}
|
|
|
|
</div>
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ form.message.errors }}
|
|
|
|
<label for="id_message">Your message:</label>
|
|
|
|
{{ form.message }}
|
|
|
|
</div>
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ form.sender.errors }}
|
|
|
|
<label for="id_sender">Your email address:</label>
|
|
|
|
{{ form.sender }}
|
|
|
|
</div>
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ form.cc_myself.errors }}
|
|
|
|
<label for="id_cc_myself">CC yourself?</label>
|
|
|
|
{{ form.cc_myself }}
|
|
|
|
</div>
|
2008-09-15 20:14:31 +08:00
|
|
|
<p><input type="submit" value="Send message" /></p>
|
2008-08-24 06:25:40 +08:00
|
|
|
</form>
|
|
|
|
|
|
|
|
Each named form-field can be output to the template using
|
|
|
|
``{{ form.name_of_field }}``, which will produce the HTML needed to display the
|
|
|
|
form widget. Using ``{{ form.name_of_field.errors }}`` displays a list of form
|
|
|
|
errors, rendered as an unordered list. This might look like::
|
|
|
|
|
|
|
|
<ul class="errorlist">
|
|
|
|
<li>Sender is required.</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
The list has a CSS class of ``errorlist`` to allow you to style its appearance.
|
|
|
|
If you wish to further customize the display of errors you can do so by looping
|
|
|
|
over them::
|
|
|
|
|
|
|
|
{% if form.subject.errors %}
|
|
|
|
<ol>
|
2008-11-22 00:25:05 +08:00
|
|
|
{% for error in form.subject.errors %}
|
2008-08-24 06:25:40 +08:00
|
|
|
<li><strong>{{ error|escape }}</strong></li>
|
|
|
|
{% endfor %}
|
|
|
|
</ol>
|
|
|
|
{% endif %}
|
2008-09-15 07:55:09 +08:00
|
|
|
|
|
|
|
Looping over the form's fields
|
|
|
|
------------------------------
|
|
|
|
|
2008-10-09 17:19:47 +08:00
|
|
|
If you're using the same HTML for each of your form fields, you can reduce
|
|
|
|
duplicate code by looping through each field in turn using a ``{% for %}``
|
|
|
|
loop::
|
2008-09-15 07:55:09 +08:00
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/contact/" method="post">
|
2008-09-15 07:55:09 +08:00
|
|
|
{% for field in form %}
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ field.errors }}
|
|
|
|
{{ field.label_tag }}: {{ field }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2008-09-15 20:14:31 +08:00
|
|
|
<p><input type="submit" value="Send message" /></p>
|
2008-09-15 07:55:09 +08:00
|
|
|
</form>
|
|
|
|
|
2008-09-15 08:13:25 +08:00
|
|
|
Within this loop, ``{{ field }}`` is an instance of :class:`BoundField`.
|
2008-09-16 13:22:08 +08:00
|
|
|
``BoundField`` also has the following attributes, which can be useful in your
|
2008-09-15 08:13:25 +08:00
|
|
|
templates:
|
2008-09-15 07:55:09 +08:00
|
|
|
|
|
|
|
``{{ field.label }}``
|
2011-04-02 00:10:22 +08:00
|
|
|
The label of the field, e.g. ``Email address``.
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-09-15 07:55:09 +08:00
|
|
|
``{{ field.label_tag }}``
|
2008-09-16 13:22:08 +08:00
|
|
|
The field's label wrapped in the appropriate HTML ``<label>`` tag,
|
2011-04-02 00:10:22 +08:00
|
|
|
e.g. ``<label for="id_email">Email address</label>``
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-09-15 07:55:09 +08:00
|
|
|
``{{ field.html_name }}``
|
2008-09-16 13:22:08 +08:00
|
|
|
The name of the field that will be used in the input element's name
|
|
|
|
field. This takes the form prefix into account, if it has been set.
|
|
|
|
|
2008-09-15 08:13:25 +08:00
|
|
|
``{{ field.help_text }}``
|
2008-09-15 07:55:09 +08:00
|
|
|
Any help text that has been associated with the field.
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-09-15 08:13:25 +08:00
|
|
|
``{{ field.errors }}``
|
|
|
|
Outputs a ``<ul class="errorlist">`` containing any validation errors
|
2008-09-16 13:22:08 +08:00
|
|
|
corresponding to this field. You can customize the presentation of
|
|
|
|
the errors with a ``{% for error in field.errors %}`` loop. In this
|
|
|
|
case, each object in the loop is a simple string containing the error
|
|
|
|
message.
|
2008-09-15 08:13:25 +08:00
|
|
|
|
2008-12-05 12:22:00 +08:00
|
|
|
``field.is_hidden``
|
Fixed #10389, #10501, #10502, #10540, #10562, #10563, #10564, #10565, #10568, #10569, #10614, #10617, #10619 -- Fixed several typos as well as a couple minor issues in the docs, patches from timo, nih, bthomas, rduffield, UloPe, and sebleier@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10242 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 15:01:01 +08:00
|
|
|
This attribute is ``True`` if the form field is a hidden field and
|
2008-12-05 12:22:00 +08:00
|
|
|
``False`` otherwise. It's not particularly useful as a template
|
|
|
|
variable, but could be useful in conditional tests such as::
|
|
|
|
|
|
|
|
{% if field.is_hidden %}
|
|
|
|
{# Do something special #}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
Looping over hidden and visible fields
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2008-12-08 12:07:42 +08:00
|
|
|
If you're manually laying out a form in a template, as opposed to relying on
|
|
|
|
Django's default form layout, you might want to treat ``<input type="hidden">``
|
|
|
|
fields differently than non-hidden fields. For example, because hidden fields
|
|
|
|
don't display anything, putting error messages "next to" the field could cause
|
|
|
|
confusion for your users -- so errors for those fields should be handled
|
|
|
|
differently.
|
2008-12-05 12:22:00 +08:00
|
|
|
|
|
|
|
Django provides two methods on a form that allow you to loop over the hidden
|
|
|
|
and visible fields independently: ``hidden_fields()`` and
|
2008-12-08 12:07:42 +08:00
|
|
|
``visible_fields()``. Here's a modification of an earlier example that uses
|
|
|
|
these two methods::
|
2008-12-05 12:22:00 +08:00
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/contact/" method="post">
|
2011-09-13 16:22:53 +08:00
|
|
|
{# Include the hidden fields #}
|
|
|
|
{% for hidden in form.hidden_fields %}
|
|
|
|
{{ hidden }}
|
|
|
|
{% endfor %}
|
|
|
|
{# Include the visible fields #}
|
2008-12-05 12:22:00 +08:00
|
|
|
{% for field in form.visible_fields %}
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ field.errors }}
|
|
|
|
{{ field.label_tag }}: {{ field }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<p><input type="submit" value="Send message" /></p>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
This example does not handle any errors in the hidden fields. Usually, an
|
|
|
|
error in a hidden field is a sign of form tampering, since normal form
|
|
|
|
interaction won't alter them. However, you could easily insert some error
|
2008-12-08 12:07:42 +08:00
|
|
|
displays for those form errors, as well.
|
2008-12-05 12:22:00 +08:00
|
|
|
|
2008-09-15 17:30:05 +08:00
|
|
|
Reusable form templates
|
|
|
|
-----------------------
|
|
|
|
|
2008-09-16 13:31:00 +08:00
|
|
|
If your site uses the same rendering logic for forms in multiple places, you
|
|
|
|
can reduce duplication by saving the form's loop in a standalone template and
|
|
|
|
using the :ttag:`include` tag to reuse it in other templates::
|
2008-09-15 17:30:05 +08:00
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/contact/" method="post">
|
2008-09-15 17:30:05 +08:00
|
|
|
{% include "form_snippet.html" %}
|
2008-09-15 20:14:31 +08:00
|
|
|
<p><input type="submit" value="Send message" /></p>
|
2008-09-15 17:30:05 +08:00
|
|
|
</form>
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-09-15 17:30:05 +08:00
|
|
|
# In form_snippet.html:
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-09-15 17:30:05 +08:00
|
|
|
{% for field in form %}
|
|
|
|
<div class="fieldWrapper">
|
|
|
|
{{ field.errors }}
|
|
|
|
{{ field.label_tag }}: {{ field }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
|
2008-09-16 13:22:08 +08:00
|
|
|
If the form object passed to a template has a different name within the
|
2010-12-18 10:50:26 +08:00
|
|
|
context, you can alias it using the ``with`` argument of the :ttag:`include`
|
|
|
|
tag::
|
2008-09-15 17:30:05 +08:00
|
|
|
|
2010-01-05 05:55:52 +08:00
|
|
|
<form action="/comments/add/" method="post">
|
2010-12-18 10:50:26 +08:00
|
|
|
{% include "form_snippet.html" with form=comment_form %}
|
2008-09-15 20:14:31 +08:00
|
|
|
<p><input type="submit" value="Submit comment" /></p>
|
2008-09-15 17:30:05 +08:00
|
|
|
</form>
|
|
|
|
|
2008-09-16 13:31:00 +08:00
|
|
|
If you find yourself doing this often, you might consider creating a custom
|
|
|
|
:ref:`inclusion tag<howto-custom-template-tags-inclusion-tags>`.
|
2008-09-15 23:44:59 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
Further topics
|
|
|
|
==============
|
|
|
|
|
|
|
|
This covers the basics, but forms can do a whole lot more:
|
|
|
|
|
|
|
|
.. toctree::
|
2010-10-10 15:08:35 +08:00
|
|
|
:maxdepth: 2
|
2008-08-24 06:25:40 +08:00
|
|
|
|
|
|
|
formsets
|
2011-02-08 07:39:29 +08:00
|
|
|
modelforms
|
2008-08-24 06:25:40 +08:00
|
|
|
media
|
2008-09-16 13:22:08 +08:00
|
|
|
|
2008-08-24 06:25:40 +08:00
|
|
|
.. seealso::
|
|
|
|
|
2010-10-10 15:08:35 +08:00
|
|
|
:doc:`The Forms Reference </ref/forms/index>`
|
2010-12-27 05:50:16 +08:00
|
|
|
Covers the full API reference, including form fields, form widgets,
|
2010-10-10 15:08:35 +08:00
|
|
|
and form and field validation.
|