summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-01-01 08:12:42 -0500
committerTim Graham <timograham@gmail.com>2013-01-02 18:50:00 -0500
commitbe1e006c581cc45ed48ae0b423e7a0a996d2199b (patch)
tree5e33669588d7c8d2a49d99f82ae87524d22a9455 /docs/ref/forms
parent61c861546bdbae694f22e2c54e9ca0f42331cae1 (diff)
[1.5.x] Fixed #19516 - Fixed remaining broken links.
Added -n to sphinx builds to catch issues going forward. Backport of 9b5f64cc6e from master.
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/api.txt41
-rw-r--r--docs/ref/forms/widgets.txt12
2 files changed, 27 insertions, 26 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index ab1f4b0eea..4aacbf0a0d 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -2,9 +2,7 @@
The Forms API
=============
-.. module:: django.forms.forms
-
-.. currentmodule:: django.forms
+.. module:: django.forms
.. admonition:: About this document
@@ -380,6 +378,9 @@ a form object, and each rendering method returns a Unicode object.
Styling required or erroneous form rows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. attribute:: Form.error_css_class
+.. attribute:: Form.required_css_class
+
It's pretty common to style form rows and fields that are required or have
errors. For example, you might want to present required form rows in bold and
highlight errors in red.
@@ -587,24 +588,24 @@ lazy developers -- they're not the only way a form object can be displayed.
Used to display HTML or access attributes for a single field of a
:class:`Form` instance.
- The :meth:`__unicode__` and :meth:`__str__` methods of this object displays
+ The ``__unicode__()`` and ``__str__()`` methods of this object displays
the HTML for this field.
To retrieve a single ``BoundField``, use dictionary lookup syntax on your form
using the field's name as the key::
- >>> form = ContactForm()
- >>> print(form['subject'])
- <input id="id_subject" type="text" name="subject" maxlength="100" />
+ >>> form = ContactForm()
+ >>> print(form['subject'])
+ <input id="id_subject" type="text" name="subject" maxlength="100" />
To retrieve all ``BoundField`` objects, iterate the form::
- >>> form = ContactForm()
- >>> for boundfield in form: print(boundfield)
- <input id="id_subject" type="text" name="subject" maxlength="100" />
- <input type="text" name="message" id="id_message" />
- <input type="text" name="sender" id="id_sender" />
- <input type="checkbox" name="cc_myself" id="id_cc_myself" />
+ >>> form = ContactForm()
+ >>> for boundfield in form: print(boundfield)
+ <input id="id_subject" type="text" name="subject" maxlength="100" />
+ <input type="text" name="message" id="id_message" />
+ <input type="text" name="sender" id="id_sender" />
+ <input type="checkbox" name="cc_myself" id="id_cc_myself" />
The field-specific output honors the form object's ``auto_id`` setting::
@@ -635,7 +636,7 @@ For a field's list of errors, access the field's ``errors`` attribute.
>>> print(f['subject'].errors)
>>> str(f['subject'].errors)
- ''
+ ''
.. method:: BoundField.css_classes()
@@ -644,17 +645,17 @@ indicate required form fields or fields that contain errors. If you're
manually rendering a form, you can access these CSS classes using the
``css_classes`` method::
- >>> f = ContactForm(data)
- >>> f['message'].css_classes()
- 'required'
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes()
+ 'required'
If you want to provide some additional classes in addition to the
error and required classes that may be required, you can provide
those classes as an argument::
- >>> f = ContactForm(data)
- >>> f['message'].css_classes('foo bar')
- 'foo bar required'
+ >>> f = ContactForm(data)
+ >>> f['message'].css_classes('foo bar')
+ 'foo bar required'
.. method:: BoundField.value()
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 0660329eea..3df398de22 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -508,9 +508,9 @@ Selector and checkbox widgets
.. attribute:: Select.choices
- This attribute is optional when the field does not have a
- :attr:`~Field.choices` attribute. If it does, it will override anything
- you set here when the attribute is updated on the :class:`Field`.
+ This attribute is optional when the form field does not have a
+ ``choices`` attribute. If it does, it will override anything you set
+ here when the attribute is updated on the :class:`Field`.
``NullBooleanSelect``
~~~~~~~~~~~~~~~~~~~~~
@@ -662,9 +662,9 @@ Composite widgets
.. attribute:: MultipleHiddenInput.choices
- This attribute is optional when the field does not have a
- :attr:`~Field.choices` attribute. If it does, it will override anything
- you set here when the attribute is updated on the :class:`Field`.
+ This attribute is optional when the form field does not have a
+ ``choices`` attribute. If it does, it will override anything you set
+ here when the attribute is updated on the :class:`Field`.
``SplitDateTimeWidget``
~~~~~~~~~~~~~~~~~~~~~~~