summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-08-19 18:30:48 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-08-19 18:30:48 +0100
commitb6a957f0ba8a2ed1b24d7ee042a9c4beaf51ab03 (patch)
tree87d42b9e8d3d4c1516b53eee1d9332735762826a /docs/ref/forms
parent52edc16086e3c28a78c31975bb4da2f9450590b4 (diff)
parent3c0300405009b82b52fd15483371097221662fcd (diff)
Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts: docs/ref/django-admin.txt
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/api.txt5
-rw-r--r--docs/ref/forms/fields.txt9
-rw-r--r--docs/ref/forms/validation.txt10
-rw-r--r--docs/ref/forms/widgets.txt70
4 files changed, 43 insertions, 51 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index 780cb5d4f7..f084273cd9 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -211,11 +211,6 @@ only the valid fields::
>>> f.cleaned_data
{'cc_myself': True, 'message': u'Hi there'}
-.. versionchanged:: 1.5
-
-Until Django 1.5, the ``cleaned_data`` attribute wasn't defined at all when
-the ``Form`` didn't validate.
-
``cleaned_data`` will always *only* contain a key for fields defined in the
``Form``, even if you pass extra data when you define the ``Form``. In this
example, we pass a bunch of extra fields to the ``ContactForm`` constructor,
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index e7c6612a72..0e4d352132 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -573,16 +573,12 @@ For each field, we describe the default widget used if you don't specify
.. attribute:: allow_files
- .. versionadded:: 1.5
-
Optional. Either ``True`` or ``False``. Default is ``True``. Specifies
whether files in the specified location should be included. Either this or
:attr:`allow_folders` must be ``True``.
.. attribute:: allow_folders
- .. versionadded:: 1.5
-
Optional. Either ``True`` or ``False``. Default is ``False``. Specifies
whether folders in the specified location should be included. Either this or
:attr:`allow_files` must be ``True``.
@@ -1065,11 +1061,6 @@ objects (in the case of ``ModelMultipleChoiceField``) into the
* Error message keys: ``required``, ``list``, ``invalid_choice``,
``invalid_pk_value``
- .. versionchanged:: 1.5
-
- The empty and normalized values were changed to be consistently
- ``QuerySets`` instead of ``[]`` and ``QuerySet`` respectively.
-
.. versionchanged:: 1.6
The ``invalid_choice`` message may contain ``%(value)s`` and the
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index 255b665c42..94e9308c9a 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -450,11 +450,5 @@ entries in ``_errors``.
Secondly, once we have decided that the combined data in the two fields we are
considering aren't valid, we must remember to remove them from the
-``cleaned_data``.
-
-.. versionchanged:: 1.5
-
- Django used to remove the ``cleaned_data`` attribute entirely if there were
- any errors in the form. Since version 1.5, ``cleaned_data`` is present even if
- the form doesn't validate, but it contains only field values that did
- validate.
+``cleaned_data``. `cleaned_data`` is present even if the form doesn't
+validate, but it contains only field values that did validate.
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 080d1fea86..47e14043fc 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -525,11 +525,6 @@ Selector and checkbox widgets
A callable that takes the value of the CheckBoxInput and returns
``True`` if the checkbox should be checked for that value.
- .. versionchanged:: 1.5
-
- Exceptions from ``check_test`` used to be silenced by its caller,
- this is no longer the case, they will propagate upwards.
-
``Select``
~~~~~~~~~~
@@ -590,25 +585,26 @@ Selector and checkbox widgets
.. code-block:: html
<div class="myradio">
- <label><input type="radio" name="beatles" value="john" /> John</label>
+ <label for="id_beatles_0"><input id="id_beatles_0" name="beatles" type="radio" value="john" /> John</label>
</div>
<div class="myradio">
- <label><input type="radio" name="beatles" value="paul" /> Paul</label>
+ <label for="id_beatles_1"><input id="id_beatles_1" name="beatles" type="radio" value="paul" /> Paul</label>
</div>
<div class="myradio">
- <label><input type="radio" name="beatles" value="george" /> George</label>
+ <label for="id_beatles_2"><input id="id_beatles_2" name="beatles" type="radio" value="george" /> George</label>
</div>
<div class="myradio">
- <label><input type="radio" name="beatles" value="ringo" /> Ringo</label>
+ <label for="id_beatles_3"><input id="id_beatles_3" name="beatles" type="radio" value="ringo" /> Ringo</label>
</div>
That included the ``<label>`` tags. To get more granular, you can use each
- radio button's ``tag`` and ``choice_label`` attributes. For example, this template...
+ radio button's ``tag``, ``choice_label`` and ``id_for_label`` attributes.
+ For example, this template...
.. code-block:: html+django
{% for radio in myform.beatles %}
- <label>
+ <label for="{{ radio.id_for_label }}">
{{ radio.choice_label }}
<span class="radio">{{ radio.tag }}</span>
</label>
@@ -618,31 +614,41 @@ Selector and checkbox widgets
.. code-block:: html
- <label>
- John
- <span class="radio"><input type="radio" name="beatles" value="john" /></span>
- </label>
- <label>
- Paul
- <span class="radio"><input type="radio" name="beatles" value="paul" /></span>
- </label>
- <label>
- George
- <span class="radio"><input type="radio" name="beatles" value="george" /></span>
- </label>
- <label>
- Ringo
- <span class="radio"><input type="radio" name="beatles" value="ringo" /></span>
- </label>
+ <label for="id_beatles_0">
+ John
+ <span class="radio"><input id="id_beatles_0" name="beatles" type="radio" value="john" /></span>
+ </label>
+
+ <label for="id_beatles_1">
+ Paul
+ <span class="radio"><input id="id_beatles_1" name="beatles" type="radio" value="paul" /></span>
+ </label>
- If you decide not to loop over the radio buttons -- e.g., if your template simply includes
- ``{{ myform.beatles }}`` -- they'll be output in a ``<ul>`` with ``<li>`` tags, as above.
+ <label for="id_beatles_2">
+ George
+ <span class="radio"><input id="id_beatles_2" name="beatles" type="radio" value="george" /></span>
+ </label>
+
+ <label for="id_beatles_3">
+ Ringo
+ <span class="radio"><input id="id_beatles_3" name="beatles" type="radio" value="ringo" /></span>
+ </label>
+
+ If you decide not to loop over the radio buttons -- e.g., if your template
+ simply includes ``{{ myform.beatles }}`` -- they'll be output in a ``<ul>``
+ with ``<li>`` tags, as above.
.. versionchanged:: 1.6
The outer ``<ul>`` container will now receive the ``id`` attribute defined on
the widget.
+.. versionchanged:: 1.7
+
+ When looping over the radio buttons, the ``label`` and ``input`` tags include
+ ``for`` and ``id`` attributes, respectively. Each radio button has an
+ ``id_for_label`` attribute to output the element's ID.
+
``CheckboxSelectMultiple``
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -666,6 +672,12 @@ the widget.
Like :class:`RadioSelect`, you can now loop over the individual checkboxes making
up the lists. See the documentation of :class:`RadioSelect` for more details.
+.. versionchanged:: 1.7
+
+ When looping over the checkboxes, the ``label`` and ``input`` tags include
+ ``for`` and ``id`` attributes, respectively. Each checkbox has an
+ ``id_for_label`` attribute to output the element's ID.
+
.. _file-upload-widgets:
File upload widgets