Browse files

[1.6.x] Improvement on InlineFormSet doc, refs #21006

Backport of 944a2bb from master
  • Loading branch information...
1 parent ecfd958 commit 1241a2cc104d092ff0f03a16a664e9e4ab801dd1 @3quarterstack 3quarterstack committed with timgraham Oct 15, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 docs/topics/forms/modelforms.txt
View
12 docs/topics/forms/modelforms.txt
@@ -916,7 +916,7 @@ class's ``clean`` method::
class MyModelFormSet(BaseModelFormSet):
def clean(self):
super(MyModelFormSet, self).clean()
- # example custom validation across forms in the formset:
+ # example custom validation across forms in the formset
for form in self.forms:
# your custom formset validation
...
@@ -1053,14 +1053,14 @@ When overriding methods on ``InlineFormSet``, you should subclass
:class:`~models.BaseInlineFormSet` rather than
:class:`~models.BaseModelFormSet`.
-For example, If you want to override ``clean()``::
+For example, if you want to override ``clean()``::
from django.forms.models import BaseInlineFormSet
- class MyModelFormSet(BaseInlineFormSet):
+ class CustomInlineFormSet(BaseInlineFormSet):
def clean(self):
- super(MyModelFormSet, self).clean()
- # example custom validation across forms in the formset:
+ super(CustomInlineFormSet, self).clean()
+ # example custom validation across forms in the formset
for form in self.forms:
# your custom formset validation
...
@@ -1071,7 +1071,7 @@ Then when you create your inline formset, pass in the optional argument
``formset``::
>>> from django.forms.models import inlineformset_factory
- >>> BookFormSet = inlineformset_factory(Author, Book, formset=MyModelFormSet)
+ >>> BookFormSet = inlineformset_factory(Author, Book, formset=CustomInlineFormSet)
>>> author = Author.objects.get(name=u'Mike Royko')
>>> formset = BookFormSet(instance=author)

0 comments on commit 1241a2c

Please sign in to comment.