0

I saw a what might be a solution to my problem here but i tried to understand and implement the code on what is indicated in the solution with no avail.

As what I understand( if correct ), in the views, the use of cp = request.POST.copy() is to copy what is in the form and then the use of cp['prim-TOTAL_FORMS'] = int(cp['prim-TOTAL_FORMS'])+ 1 is to add the field but from there I am lost

Sorry for my newbie question because I am very new to django.

Any pointers, suggestion, or even a sample code would helpful and much appreciated.

Thank you in advance.

Community
  • 1
  • 1
Juan Carlos Asuncion
  • 927
  • 2
  • 10
  • 26

1 Answers1

0

I am currently working to figure this out myself. The best I could come up with is an a input type="number" and a separate input type="submit" with an "add rows" action. We can check the add rows with request.POST.get('action') to see if we are submitting for review or adding additional forms. This is as far as I am currently. I can read the number input, but when I pass it to the formset_factory via the extra attribute. Have you solved this?

  • I know this is old and really, I haven't solved this one yet but there is a library that might help [here](https://github.com/elo80ka/django-dynamic-formset), I used it and works great so far – Juan Carlos Asuncion Feb 20 '16 at 18:02