Fixed #6265 -- Added an example of overriding a form field's default widget in the modelforms docs, based on patch from programmerq.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2008-01-28 03:12:28 +00:00
parent b24ad9a06b
commit 3fd5b5d6a8
1 changed files with 11 additions and 2 deletions

View File

@ -311,3 +311,12 @@ field, you could do the following::
...
... class Meta:
... model = Article
If you want to override a field's default widget, then specify the ``widget``
parameter when declaring the form field::
>>> class ArticleForm(ModelForm):
... pub_date = DateField(widget=MyDateWidget())
...
... class Meta:
... model = Article