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