Dynamically adding a form to a Django formset with Ajax

后端 未结 15 1935
不思量自难忘°
不思量自难忘° 2020-11-22 03:09

I want to automatically add new forms to a Django formset using Ajax, so that when the user clicks an \"add\" button it runs JavaScript that adds a new form (which is part o

15条回答
  •  遥遥无期
    2020-11-22 03:40

    For the coders out there who are hunting resources to understand the above solutions a little better:

    Django Dynamic Formsets

    After reading the above link, the Django documentation and previous solutions should make a lot more sense.

    Django Formset Documentation

    As a quick summary of what I was getting confused by: The Management Form contains an overview of the forms within. You must keep that information accurate in order for Django to be aware of the forms you add. (Community, please give me suggestions if some of my wording is off here. Im new to Django.)

提交回复
热议问题