diff options
| author | David Smith <smithdc@gmail.com> | 2023-02-12 13:20:05 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-02-15 10:14:09 +0100 |
| commit | 232b60a21b951bd16b8c95b34fcbcbf3ecd89fca (patch) | |
| tree | eb4f83408329d4950242156ca8d53c4330ad3f18 /docs/ref/forms/widgets.txt | |
| parent | 4038a8df0b8c20624ba826cf9af8f532e5a51aaa (diff) | |
Refs #32339 -- Updated docs to reflect default <div> style form rendering in Django 5.0.
Follow up to 98756c685ee173bbd43f21ed0553f808be835ce5.
Diffstat (limited to 'docs/ref/forms/widgets.txt')
| -rw-r--r-- | docs/ref/forms/widgets.txt | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 45b154f753..43a579b4a5 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -144,10 +144,10 @@ provided for each widget will be rendered exactly the same: .. code-block:: pycon >>> f = CommentForm(auto_id=False) - >>> f.as_table() - <tr><th>Name:</th><td><input type="text" name="name" required></td></tr> - <tr><th>Url:</th><td><input type="url" name="url" required></td></tr> - <tr><th>Comment:</th><td><input type="text" name="comment" required></td></tr> + >>> print(f) + <div>Name:<input type="text" name="name" required></div> + <div>Url:<input type="url" name="url" required></div> + <div>Comment:<input type="text" name="comment" required></div> On a real web page, you probably don't want every widget to look the same. You might want a larger input element for the comment, and you might want the @@ -182,10 +182,10 @@ you can use the :attr:`Form.fields` attribute:: 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" required></td></tr> - <tr><th>Url:</th><td><input type="url" name="url" required></td></tr> - <tr><th>Comment:</th><td><input type="text" name="comment" size="40" required></td></tr> + >>> print(f) + <div>Name:<input type="text" name="name" class="special" required></div> + <div>Url:<input type="url" name="url" required></div> + <div>Comment:<input type="text" name="comment" size="40" required></div> You can also set the HTML ``id`` using :attr:`~Widget.attrs`. See :attr:`BoundField.id_for_label` for an example. |
