summaryrefslogtreecommitdiff
path: root/docs/releases
diff options
context:
space:
mode:
authorGabe Jackson <gabejackson@cxg.ch>2012-06-08 15:32:35 +0200
committerTim Graham <timograham@gmail.com>2013-06-10 14:23:15 -0400
commit584bd14dcfdee9585fec7794d53ce120ea73d0bc (patch)
tree7303b054d610767073934793ae1223404444c9de /docs/releases
parenta643e4d200e12d1570174fec343a27d6bc47f735 (diff)
Fixed #18134 -- BoundField.label_tag now includes the form's label_suffix
There was an inconsistency between how the label_tag for forms were generated depending on which method was used: as_p, as_ul and as_table contained code to append the label_suffix where as label_tag called on a form field directly did NOT append the label_suffix. The code for appending the label_suffix has been moved in to the label_tag code of the field and the HTML generation code for as_p, as_ul and as_table now calls this code as well. This is a backwards incompatible change because users who have added the label_suffix manually in their templates may now get double label_suffix characters in their forms.
Diffstat (limited to 'docs/releases')
-rw-r--r--docs/releases/1.6.txt31
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt
index 6736af8c2d..e5cd3273dc 100644
--- a/docs/releases/1.6.txt
+++ b/docs/releases/1.6.txt
@@ -581,6 +581,37 @@ It is still possible to convert the fetched rows to ``Model`` objects
lazily by using the :meth:`~django.db.models.query.QuerySet.iterator()`
method.
+:meth:`BoundField.label_tag<django.forms.BoundField.label_tag>` now includes the form's :attr:`~django.forms.Form.label_suffix`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is consistent with how methods like
+:meth:`Form.as_p<django.forms.Form.as_p>` and
+:meth:`Form.as_ul<django.forms.Form.as_ul>` render labels.
+
+If you manually render ``label_tag`` in your templates:
+
+.. code-block:: html+django
+
+ {{ form.my_field.label_tag }}: {{ form.my_field }}
+
+you'll want to remove the semicolon (or whatever other separator you may be
+using) to avoid duplicating it when upgrading to Django 1.6. The following
+template in Django 1.6 will render identically to the above template in Django
+1.5, except that the semicolon will appear inside the ``<label>`` element.
+
+.. code-block:: html+django
+
+ {{ form.my_field.label_tag }} {{ form.my_field }}
+
+will render something like:
+
+.. code-block:: html
+
+ <label for="id_my_field">My Field:</label> <input id="id_my_field" type="text" name="my_field" />
+
+If you want to keep the current behavior of rendering ``label_tag`` without
+the ``label_suffix``, instantiate the form ``label_suffix=''``.
+
Miscellaneous
~~~~~~~~~~~~~