Fixed #13269 -- Added clarifying import statement to widget override docs. Thanks to mattrowbum for the report, and Gabriel Hurley for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0cb2ae9123
commit
e34ca2b1e2
|
@ -379,9 +379,12 @@ To specify a custom widget for a field, use the ``widgets`` attribute of the
|
||||||
inner ``Meta`` class. This should be a dictionary mapping field names to widget
|
inner ``Meta`` class. This should be a dictionary mapping field names to widget
|
||||||
classes or instances.
|
classes or instances.
|
||||||
|
|
||||||
For example, if you want the a ``CharField`` to be represented by a
|
For example, if you want the a ``CharField`` for the ``name``
|
||||||
``<textarea>`` instead of its default ``<input type="text">``, you can override
|
attribute of ``Author`` to be represented by a ``<textarea>`` instead
|
||||||
the field's widget::
|
of its default ``<input type="text">``, you can override the field's
|
||||||
|
widget::
|
||||||
|
|
||||||
|
from django.forms import ModelForm, TextArea
|
||||||
|
|
||||||
class AuthorForm(ModelForm):
|
class AuthorForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in New Issue