Add an example of the formset argument for inlineformset_factory
|Reported by:||Owned by:||Tianyi Wang|
|Cc:||treysta@…, Daniele Procida||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by )
It looks like there is a somewhat relevant piece of information missing from this section. It leaves out the fact that you also must specify which formset to use when creating your inlineformset in the view:
"See Overriding clean() on a ModelFormSet, but subclass BaseInlineFormSet rather than BaseModelFormSet."
"See Overriding clean() on a ModelFormSet, but subclass BaseInlineFormSet rather than BaseModelFormSet. You must also specify which formset to use when creating your inlineformset in your view:"
>>> from django.forms.models import inlineformset_factory >>> BookFormSet = inlineformset_factory(Author, Book, formset= MyInlineFormSet) >>> author = Author.objects.get(name=u'Mike Royko') >>> formset = BookFormSet(instance=author)
Change History (12)
comment:1 Changed 4 years ago by
|Summary:||Overriding clean() on an InlineFormSet → Add an example of the formset argument for inlineformset_factory|
|Triage Stage:||Unreviewed → Accepted|
|Type:||Uncategorized → Cleanup/optimization|