> I'm trying to make use inlineformset_factory to add several data on an > object at the sime time. I want to show 5 extra forms but when I view > it in browser it only shows 1formsets instead of 5. > > Here's my view code: > formset = inlineformset_factory(PackagingReport, PeopleProblem, > max_num=0, extra=5, exclude=('report') )
This is incomplete. The 'formset' here is a class that you need to instantiate. packaging_report = # create some packaging report instance here... formset_instance = formset(instance=packaging_report) # send formset_instance to your template and loop over formset_instance.forms. If you rename your formset above to FormSet it's easier to remember that it's a class. So, your code would look like this: PeopleProblemFormSet = inlineformset_factory(PackagingReport, PeopleProblem, max_num=0, extra=5, exclude=('report')) packaging_report = # create some packaging report instance here... formset = formset(instance=packaging_report) > > In the template: > > <form action="" method="post"> > {% for form in formset.form %} > {{ form }} > {% endfor %} > > I tried using formset.forms but its not working but when I tried > formset.form it only shows 1extra form: > <table> > {{ formset.form }} > </table> > <input class="button" type="submit" value="Create Report"> > <input class="button" type="reset"> > > </form> > > I tried following instructions on formsets, modelformsets, and > inlineformsets but it didn't work. Could anyone tell me how to use > inlineformset in views and in template? I'm using Django1.0.3. > -Rajesh D --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---