mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Fixed #35889 -- Corrected reference of default widgets in "Styling widget instance" docs.
This commit is contained in:
parent
dceaed0822
commit
eacfe0137c
@ -142,9 +142,9 @@ For example, take the following form::
|
|||||||
url = forms.URLField()
|
url = forms.URLField()
|
||||||
comment = forms.CharField()
|
comment = forms.CharField()
|
||||||
|
|
||||||
This form will include three default :class:`TextInput` widgets, with default
|
This form will include :class:`TextInput` widgets for the name and comment
|
||||||
rendering -- no CSS class, no extra attributes. This means that the input boxes
|
fields, and a :class:`URLInput` widget for the url field. Each has default
|
||||||
provided for each widget will be rendered exactly the same:
|
rendering - no CSS class, no extra attributes:
|
||||||
|
|
||||||
.. code-block:: pycon
|
.. code-block:: pycon
|
||||||
|
|
||||||
@ -154,11 +154,11 @@ provided for each widget will be rendered exactly the same:
|
|||||||
<div>Url:<input type="url" name="url" required></div>
|
<div>Url:<input type="url" name="url" required></div>
|
||||||
<div>Comment:<input type="text" name="comment" 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
|
On a real web page, you probably want to customize this. You might want a
|
||||||
might want a larger input element for the comment, and you might want the
|
larger input element for the comment, and you might want the 'name' widget to
|
||||||
'name' widget to have some special CSS class. It is also possible to specify
|
have some special CSS class. It is also possible to specify the 'type'
|
||||||
the 'type' attribute to take advantage of the new HTML5 input types. To do
|
attribute to use a different HTML5 input type. To do this, you use the
|
||||||
this, you use the :attr:`Widget.attrs` argument when creating the widget::
|
:attr:`Widget.attrs` argument when creating the widget::
|
||||||
|
|
||||||
class CommentForm(forms.Form):
|
class CommentForm(forms.Form):
|
||||||
name = forms.CharField(widget=forms.TextInput(attrs={"class": "special"}))
|
name = forms.CharField(widget=forms.TextInput(attrs={"class": "special"}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user