Re: Inline formset with different default values for each "extra" row

38 views
Skip to first unread message

Chris Cogdon

unread,
Dec 4, 2012, 7:35:55 PM12/4/12
to django...@googlegroups.com
Because Lee Hinde's thread is broken, I'm going to take a punt at what the question is :)

in a formset (inline, model, or just a plain one), the "initial" parameter to the instantiation of the form takes an list of dictionaries. Each element in the list is the initial data for _that_ row... so if you want 5 different part numbers, for example, do this.


formset = MyFormSet ( ..other params..,  initial=[{'partno':10},{'partno':11},{'partno':12},{'partno':13},{'partno':14}] )
Reply all
Reply to author
Forward
0 new messages