Opened 5 years ago

Closed 5 years ago

#16467 closed Cleanup/optimization (fixed)

Little typo in the Formset docu

Reported by: hannes.hapke@… Owned by: teraom
Component: Documentation Version: 1.3
Severity: Normal Keywords: form inital value
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Is it possible that the example regarding "Using initial data with a formset" has too many brackets?

>>> formset = ArticleFormSet(initial=[
...     {'title': u'Django is now open source',
...      'pub_date':},
... ])

could it be ... (above did knot work for me)

>>> formset = ArticleFormSet(initial={
...     'title': u'Django is now open source',
...     'pub_date':,
... })

With the inital example I get the error msg:

dictionary update sequence element #0 has length 5; 2 is required

Just a thought.

Best regards,

Attachments (1)

formset_example.diff (689 bytes) - added by teraom 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by Bernhard Essl

Component: FormsDocumentation
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by teraom

Owner: changed from nobody to teraom
Status: newassigned

Changed 5 years ago by teraom

Attachment: formset_example.diff added

comment:3 Changed 5 years ago by teraom

Has patch: set

comment:4 Changed 5 years ago by Aymeric Augustin

Triage Stage: AcceptedReady for checkin

comment:5 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: assignedclosed

In [16564]:

Fixed #16467 -- Corrected formset code example. Thanks, teraom.

comment:6 Changed 5 years ago by dmclain

Resolution: fixed
Status: closedreopened

The documentation was correct as written. Initial should be an array of dictionaries where the dictionaries are used for successive forms.

If you look at to construct the i'th form instance the initial paramater pulls self.initial[i]

comment:7 Changed 5 years ago by Gabriel Hurley

Resolution: fixed
Status: reopenedclosed

In [16623]:

Fixed #16467 -- Restored a previously correct example which was broken in [16564]. Thanks to dmclain for pointing out that the original example was correct.

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