diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-01-28 14:24:48 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-01-28 22:11:00 +0100 |
| commit | f7394d2c32b4b4717066f254adaa513d08ab32a4 (patch) | |
| tree | ae048929e19a7597dae3013abcfe8b371382baa9 /docs/ref | |
| parent | 4f16376274a4e52074722c615fccef5fac5f009a (diff) | |
Added HTML5 url input type
Refs #16630.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/forms/api.txt | 2 | ||||
| -rw-r--r-- | docs/ref/forms/fields.txt | 8 | ||||
| -rw-r--r-- | docs/ref/forms/widgets.txt | 13 |
3 files changed, 16 insertions, 7 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 44e4684c1d..4c5c275806 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -161,7 +161,7 @@ precedence:: >>> f = CommentForm(initial={'name': 'instance'}, auto_id=False) >>> print(f) <tr><th>Name:</th><td><input type="text" name="name" value="instance" /></td></tr> - <tr><th>Url:</th><td><input type="text" name="url" /></td></tr> + <tr><th>Url:</th><td><input type="url" name="url" /></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr> Accessing "clean" data diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 8bfe77cc20..2e4e779f0c 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -112,7 +112,7 @@ We've specified ``auto_id=False`` to simplify the output:: >>> f = CommentForm(auto_id=False) >>> print(f) <tr><th>Your name:</th><td><input type="text" name="name" /></td></tr> - <tr><th>Your Web site:</th><td><input type="text" name="url" /></td></tr> + <tr><th>Your Web site:</th><td><input type="url" name="url" /></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr> ``initial`` @@ -135,7 +135,7 @@ field is initialized to a particular value. For example:: >>> f = CommentForm(auto_id=False) >>> print(f) <tr><th>Name:</th><td><input type="text" name="name" value="Your name" /></td></tr> - <tr><th>Url:</th><td><input type="text" name="url" value="http://" /></td></tr> + <tr><th>Url:</th><td><input type="url" name="url" value="http://" /></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr> You may be thinking, why not just pass a dictionary of the initial values as @@ -150,7 +150,7 @@ and the HTML output will include any validation errors:: >>> f = CommentForm(default_data, auto_id=False) >>> print(f) <tr><th>Name:</th><td><input type="text" name="name" value="Your name" /></td></tr> - <tr><th>Url:</th><td><ul class="errorlist"><li>Enter a valid URL.</li></ul><input type="text" name="url" value="http://" /></td></tr> + <tr><th>Url:</th><td><ul class="errorlist"><li>Enter a valid URL.</li></ul><input type="url" name="url" value="http://" /></td></tr> <tr><th>Comment:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="comment" /></td></tr> This is why ``initial`` values are only displayed for unbound forms. For bound @@ -805,7 +805,7 @@ For each field, we describe the default widget used if you don't specify .. class:: URLField(**kwargs) - * Default widget: :class:`TextInput` + * Default widget: :class:`URLInput` * Empty value: ``''`` (an empty string) * Normalizes to: A Unicode object. * Validates that the given value is a valid URL. diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 9105a41b25..cb5224fd3c 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -139,7 +139,7 @@ provided for each widget will be rendered exactly the same:: >>> f = CommentForm(auto_id=False) >>> f.as_table() <tr><th>Name:</th><td><input type="text" name="name" /></td></tr> - <tr><th>Url:</th><td><input type="text" name="url"/></td></tr> + <tr><th>Url:</th><td><input type="url" name="url"/></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" /></td></tr> On a real Web page, you probably don't want every widget to look the same. You @@ -160,7 +160,7 @@ Django will then include the extra attributes in the rendered output: >>> f = CommentForm(auto_id=False) >>> f.as_table() <tr><th>Name:</th><td><input type="text" name="name" class="special"/></td></tr> - <tr><th>Url:</th><td><input type="text" name="url"/></td></tr> + <tr><th>Url:</th><td><input type="url" name="url"/></td></tr> <tr><th>Comment:</th><td><input type="text" name="comment" size="40"/></td></tr> .. _styling-widget-classes: @@ -403,6 +403,15 @@ These widgets make use of the HTML elements ``input`` and ``textarea``. Text input: ``<input type="email" ...>`` +``URLInput`` +~~~~~~~~~~~~ + +.. class:: URLInput + + .. versionadded:: 1.6 + + Text input: ``<input type="url" ...>`` + ``PasswordInput`` ~~~~~~~~~~~~~~~~~ |
