forget it. it was formset.forms ... I *SWEAR* there is another example just with "for form in formset" ...
thanks anyway :) Axel. 2011/1/25 Axel Bock <[email protected]> > Hello all, > > I am trying to implement something quite simple, in my eyes. But it does > not work at all ... . Basically, I create a modelformset_factory with a > model of mine, and pass the instantiated modelformset to my template to > render. And I get the message *Caught TypeError while rendering: ' > LegFormFormSet' object is not iterable ...* (note the *FormForm*-part in > the error message? it should be one "*Form*" only ... shouldn't it?) > > The code looks like this: > def addlegs(request, mission_id=None): > *LegFormSet* = modelformset_factory(Leg, extra=3) > if not request.method == "POST": > # if mission_id is set we're being called from another method in > here ... :) > *formset = LegFormSet(queryset=Leg.objects.none())* > return rtr(request, 'flightlog/templates/addlegs.html', {* > "formset":formset*}) > else: > return redirect("/") > > and the template like this: > {% load widget_tweaks %} > <form method="post" action="/addlegs/"> > {% csrf_token %} > {{ formset.management_form }} > <table> > {% for form in formset %} > {% for field in form %} > {{ field|add_class:"myclass" }} > {% endfor %} > {% endfor %} > </table> > <input type="submit" value="Save leg data"/> > </form> > > in my eyes that's all pretty simple, but it drives me crazy right now cause > it does not work at all. in case you wonder: the management_form is rendered > correctly. The rendered code for this looks like this: > <input type="hidden" name="form-TOTAL_FORMS" value="3" > id="id_form-TOTAL_FORMS"/><input type="hidden" > name="form-INITIAL_FORMS" > value="0" > id="id_form-INITIAL_FORMS"/> > <input type="hidden" name="form-MAX_NUM_FORMS" id="id_form-MAX_NUM_FORMS"/> > > > any ideas, anyone? > > > Thanks for any help & greetings, > Axel. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

