From 4f16376274a4e52074722c615fccef5fac5f009a Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 28 Jan 2013 14:12:56 +0100 Subject: Added HTML5 email input type Refs #16630. --- docs/ref/forms/api.txt | 53 +++++++++++++++++++++++----------------------- docs/ref/forms/fields.txt | 8 +++---- docs/ref/forms/widgets.txt | 11 +++++++++- 3 files changed, 41 insertions(+), 31 deletions(-) (limited to 'docs/ref/forms') diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index d1f877ff65..44e4684c1d 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -270,7 +270,7 @@ simply ``print`` it:: >>> print(f) - + If the form is bound to data, the HTML output will include that data @@ -287,7 +287,7 @@ include ``checked="checked"`` if appropriate:: >>> print(f) - + This default output is a two-column HTML table, with a ```` for each field. @@ -297,8 +297,9 @@ Notice the following: ```` tags, nor does it include the ``
`` and ``
`` tags or an ```` tag. It's your job to do that. -* Each field type has a default HTML representation. ``CharField`` and - ``EmailField`` are represented by an ````. +* Each field type has a default HTML representation. ``CharField`` is + represented by an ```` and ``EmailField`` by an + ````. ``BooleanField`` is represented by an ````. Note these are merely sensible defaults; you can specify which HTML to use for a given field by using widgets, which we'll explain shortly. @@ -335,7 +336,7 @@ a form object, and each rendering method returns a Unicode object. >>> print(f.as_p())

-

+

``as_ul()`` @@ -350,11 +351,11 @@ a form object, and each rendering method returns a Unicode object. >>> f = ContactForm() >>> f.as_ul() - u'
  • \n
  • \n
  • \n
  • ' + u'
  • \n
  • \n
  • \n
  • ' >>> print(f.as_ul())
  • -
  • +
  • ``as_table()`` @@ -368,11 +369,11 @@ a form object, and each rendering method returns a Unicode object. >>> f = ContactForm() >>> f.as_table() - u'\n\n\n' + u'\n\n\n' >>> print(f.as_table()) - + Styling required or erroneous form rows @@ -431,17 +432,17 @@ tags nor ``id`` attributes:: >>> print(f.as_table()) Subject: Message: - Sender: + Sender: Cc myself: >>> print(f.as_ul())
  • Subject:
  • Message:
  • -
  • Sender:
  • +
  • Sender:
  • Cc myself:
  • >>> print(f.as_p())

    Subject:

    Message:

    -

    Sender:

    +

    Sender:

    Cc myself:

    If ``auto_id`` is set to ``True``, then the form output *will* include @@ -452,17 +453,17 @@ field:: >>> print(f.as_table()) - + >>> print(f.as_ul())
  • -
  • +
  • >>> print(f.as_p())

    -

    +

    If ``auto_id`` is set to a string containing the format character ``'%s'``, @@ -475,17 +476,17 @@ attributes based on the format string. For example, for a format string >>> print(f.as_table()) - + >>> print(f.as_ul())
  • -
  • +
  • >>> print(f.as_p())

    -

    +

    If ``auto_id`` is set to any other true value -- such as a string that doesn't @@ -501,13 +502,13 @@ entirely, using the ``label_suffix`` parameter:: >>> print(f.as_ul())
  • -
  • +
  • >>> f = ContactForm(auto_id='id_for_%s', label_suffix=' ->') >>> print(f.as_ul())
  • -
  • +
  • Note that the label suffix is added only if the last character of the @@ -539,19 +540,19 @@ method you're using:: >>> print(f.as_table()) Subject: Message: - Sender: + Sender: Cc myself: >>> print(f.as_ul())
  • Subject:
  • Message:
  • -
  • Sender:
  • +
  • Sender:
  • Cc myself:
  • >>> print(f.as_p())

    Subject:

    Message:

    -

    Sender:

    +

    Sender:

    Cc myself:

    Customizing the error list format @@ -574,7 +575,7 @@ pass that in at construction time::

    Subject:

    Message:

    Enter a valid email address.
    -

    Sender:

    +

    Sender:

    Cc myself:

    More granular output @@ -604,7 +605,7 @@ To retrieve all ``BoundField`` objects, iterate the form:: >>> for boundfield in form: print(boundfield) - + The field-specific output honors the form object's ``auto_id`` setting:: @@ -756,7 +757,7 @@ fields are ordered first:: >>> print(f.as_ul())
  • Subject:
  • Message:
  • -
  • Sender:
  • +
  • Sender:
  • Cc myself:
  • Priority:
  • diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 28b7e49d2d..8bfe77cc20 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -212,17 +212,17 @@ fields. We've specified ``auto_id=False`` to simplify the output:: >>> print(f.as_table()) Subject:
    100 characters max. Message: - Sender:
    A valid email address, please. + Sender:
    A valid email address, please. Cc myself: >>> print(f.as_ul()))
  • Subject: 100 characters max.
  • Message:
  • -
  • Sender: A valid email address, please.
  • +
  • Sender: A valid email address, please.
  • Cc myself:
  • >>> print(f.as_p())

    Subject: 100 characters max.

    Message:

    -

    Sender: A valid email address, please.

    +

    Sender: A valid email address, please.

    Cc myself:

    ``error_messages`` @@ -489,7 +489,7 @@ For each field, we describe the default widget used if you don't specify .. class:: EmailField(**kwargs) - * Default widget: :class:`TextInput` + * Default widget: :class:`EmailInput` * Empty value: ``''`` (an empty string) * Normalizes to: A Unicode object. * Validates that the given value is a valid email address, using a diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index bc1270094b..9105a41b25 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -392,7 +392,16 @@ These widgets make use of the HTML elements ``input`` and ``textarea``. .. class:: TextInput - Text input: ```` + Text input: ```` + +``EmailInput`` +~~~~~~~~~~~~~~ + +.. class:: EmailInput + + .. versionadded:: 1.6 + + Text input: ```` ``PasswordInput`` ~~~~~~~~~~~~~~~~~ -- cgit v1.3