Opened 12 years ago

Closed 12 years ago

#20107 closed Uncategorized (invalid)

Error in example for "Using initial data with a formset"

Reported by: anteater_sa Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

https://docs.djangoproject.com/en/1.5/topics/forms/formsets/#using-initial-data-with-a-formset

In the docs the initial dict is wrapped in a list which causes an error in Django 1.5, should be:

>>> ArticleFormSet = formset_factory(ArticleForm, extra=2)
>>> formset = ArticleFormSet(initial={
...     'title': u'Django is now open source',
...     'pub_date': datetime.date.today(),
... })

Change History (1)

comment:1 by Simon Charette, 12 years ago

Resolution: invalid
Status: newclosed

When passing initial data to a FormSet instance it's expected to be a list of dicts in order to specify initial data for individual forms.

Form on the other hand accept initial as a dict.

See TicketClosingReasons/UseSupportChannels for more details.

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