Skip to content

Commit

Permalink
Fixed #14392 -- Changed ModelForm.fields and ModelForm.exclude exampl…
Browse files Browse the repository at this point in the history
…es to use tuples instead of lists since they were used inconsistently throughout the page (it wasn't hurting anything, but consistency is nice). Thanks to lspcity for the report and gruszczy for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14134 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
Gabriel Hurley committed Oct 10, 2010
1 parent b79daef commit 548b6c7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/topics/forms/modelforms.txt
Expand Up @@ -387,7 +387,7 @@ widget::
class AuthorForm(ModelForm):
class Meta:
model = Author
fields = ['name', 'title', 'birth_date']
fields = ('name', 'title', 'birth_date')
widgets = {
'name': Textarea(attrs={'cols': 80, 'rows': 20}),
}
Expand Down Expand Up @@ -471,7 +471,7 @@ to be rendered first, we could specify the following ``ModelForm``::
>>> class BookForm(ModelForm):
... class Meta:
... model = Book
... fields = ['title', 'author']
... fields = ('title', 'author')

.. _overriding-modelform-clean-method:

Expand Down Expand Up @@ -514,7 +514,7 @@ the ``Meta.fields`` or ``Meta.excludes`` lists::

>>> class RestrictedArticleForm(EnhancedArticleForm):
... class Meta(ArticleForm.Meta):
... exclude = ['body']
... exclude = ('body',)

This adds the extra method from the ``EnhancedArticleForm`` and modifies
the original ``ArticleForm.Meta`` to remove one field.
Expand Down

0 comments on commit 548b6c7

Please sign in to comment.