Answer the question
In order to leave comments, you need to log in
How to handle multiple identical Django form fields?
Good afternoon.
There is an interesting scheme. There are 2 models in the project:
Order and Sort models.
The Order model has only the date of the order, while the Sort model has a reference to the ForeignKey of the Order model, a sort string, and a box string.
What is the point. There is a ready-made template, I am writing a backend. And on the New order page, there are, for example, 10 sort fields in the form. And you need to process all these 10 fields when you click on the button. And now, when you click on the button, a new order is created, and not 10 fields are created in the Sort table, but only the last one.
Initially, I created a form with the 'sort' field in forms.py and call this field on the page. Then, if necessary, I add another field when clicking through js. But the input names are the same.
How can I make the form send n number of sort fields and all of them are processed, and also related to 1 order.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question