Opened 5 years ago

Closed 4 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 BernhardEssl

  • Component changed from Forms to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by teraom

  • Owner changed from nobody to teraom
  • Status changed from new to assigned

Changed 5 years ago by teraom

comment:3 Changed 5 years ago by teraom

  • Has patch set

comment:4 Changed 5 years ago by aaugustin

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

In [16564]:

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

comment:6 Changed 5 years ago by dmclain

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 4 years ago by gabrielhurley

  • Resolution set to fixed
  • Status changed from reopened to closed

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