Opened 11 years ago

Last modified 11 years ago

#21006 closed Cleanup/optimization

Overriding clean() on an InlineFormSet — at Initial Version

Reported by: treysta@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords: afraid-to-commit
Cc: treysta@…, Daniele Procida Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

https://docs.djangoproject.com/en/1.5/topics/forms/modelforms/#overriding-clean-on-an-inlineformset

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:

Currently:

"See Overriding clean() on a ModelFormSet, but subclass BaseInlineFormSet rather than BaseModelFormSet."

Suggestion:

"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 (0)

Note: See TracTickets for help on using tickets.
Back to Top