diff options
| author | Daniele Procida <daniele@vurt.org> | 2013-10-15 06:56:25 -0700 |
|---|---|---|
| committer | Daniele Procida <daniele@vurt.org> | 2013-10-15 06:56:25 -0700 |
| commit | ec0e780e7ff2f6d4ac22fa8d41040e45b519e80e (patch) | |
| tree | 01b61d3ad74fd0fa2f9a50710457f258604150a7 /docs | |
| parent | 949076eb11011736f9e827adfde03c842bc1f1dd (diff) | |
| parent | 944a2bb7c1ffdbf577c3b76acd76b7df7f7e11c0 (diff) | |
Merge pull request #1751 from tmaster/ticket_21006_improvement
Improvement on InlineFormSet doc, refs #21006
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 3e716fe73c..79a5dbda9c 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -938,7 +938,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 ... @@ -1075,14 +1075,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 ... @@ -1093,7 +1093,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) |
