There is no simple solution to this problem. I'm going to try and break this explanation down into simpler parts for you, but please remember this is pretty hard stuff if you're not familiar with Django. I would second @Melvyn's advice, but if you really need to get this done you need to be patient and read.
The general idea is that you create a form, and then you make a formset which is a form of forms. The formset holds multiple forms at the same time, so in your case, you would need a form for a 'Tax' such as 'TaxForm' and then you also would need a formset to hold all the TaxForms such as 'TaxFormset'. Django formsets (mentioned above) are only the backend part of how this solution comes together. Spend some time reading the documentation <https://www.google.com/url?q=https%3A%2F%2Fdocs.djangoproject.com%2Fen%2F2.0%2Ftopics%2Fforms%2Fformsets%2F&sa=D&sntz=1&usg=AFQjCNF0o1xA9TKfuZcVNaQ911iKF4Kwcw> that @C Kirby linked. They explain that a formset contains two parts: the management forms and x number of forms. The management form will say to Django "okay we're entering three forms, which is one more than we used to have." This management form allows Django to match up each of the forms to their respective objects. All these parts get entered in in variables of the POST request. Now, the problem is that Django only helps you on the backend here. Django expects the management form to be filled out correctly, and the data in the formsets to be lined up. To achieve this, you have to do work on the frontend to create things like an 'add' button or a 'remove' button. The javascript on the front end is responsible for turning a button press (something like 'click to add tax' into "tax-INITIAL-FORMS=1" and "tax-TOTAL-FORMS=2." Personally, I've used this JQuery script: https://github.com/elo80ka/django-dynamic-formset which has allowed me to have an 'add' and 'remove' buttons similar to what you have shown. It will handle the heavy lifting of making this translation of button presses to management form data. Hope this helps. On Friday, July 20, 2018 at 12:51:13 AM UTC-5, Django Lover wrote: > > @Melvyn Sopacua Can you please give me simple solution of this problem? > > On Friday, July 20, 2018 at 11:15:06 AM UTC+5:30, Melvyn Sopacua wrote: >> >> On donderdag 19 juli 2018 16:18:07 CEST Django Lover wrote: >> > This is hard for me understand can you please give some code. I am new >> in >> > Django. PLEASE HELP ME >> >> If you're new to Django don't try to do this and learn more about Django >> first. >> You don't have the knowledge to break down your problem into the right >> components, which for a Django developer up to the task would be very >> simple >> (as shown by the replies). >> Walk before your run. >> -- >> Melvyn Sopacua >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ba8e533f-bbba-4875-a976-68514f600db6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.