Only a few of the fields need to be repeated in the form, not the entire form. /Angelika
On Thursday, July 5, 2012 4:35:18 PM UTC+2, Melvyn Sopacua wrote: > > On 5-7-2012 16:26, Tom Evans wrote: > > On Thu, Jul 5, 2012 at 1:15 PM, angelika <angelika.ols...@gmail.com> > wrote: > >> I've written a longer post here: > >> > http://stackoverflow.com/questions/11341118/printing-repeated-django-form-fields-individually > > >> explaining what I need. Either a way to individually print out the > fields in > >> a loop or a way to insert html from the backend. Maybe it's just not > >> possible to do this in Django and then I will think of another > solution, but > >> I would like to make sure before I solve it another way. > >> > >> /Angelika > >> > > > > Of course it is possible. When you create the fields in the init > > method, make sure they are given distinct names. Store the names of > > the generated fields in a list on the form object, and then provide an > > iterator method that yields the variable fields in the order you want. > > [snip] > > Nice solution, but weren't formsets made for this type of thing? I'm > trying to figure out why formsets couldn't be used here and coming up > blank, unless the naming convention is somehow unchangeable. > -- > Melvyn Sopacua > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/2VPkgLFqqjQJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.