Kaydet (Commit) 3fd5b5d6 authored tarafından Gary Wilson Jr's avatar Gary Wilson Jr

Fixed #6265 -- Added an example of overriding a form field's default widget in…

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
üst b24ad9a0
...@@ -311,3 +311,12 @@ field, you could do the following:: ...@@ -311,3 +311,12 @@ field, you could do the following::
... ...
... class Meta: ... class Meta:
... model = Article ... 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment