Dynamically adding a form to a Django formset with Ajax

后端 未结 15 2124
不思量自难忘°
不思量自难忘° 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:19

    I think this is a much better solution.

    How would you make a dynamic formset in Django?

    Does things clone doesn't:

    • Add form when no initial forms exists
    • Handles javascript in the form better, for example django-ckeditor
    • Keep initial data

提交回复
热议问题