Using django-dynamic-formset with CreateWithInlinesView from django-extra-views - multiple formsets

血红的双手。 提交于 2019-11-30 00:54:42

Oh my head ... I figured it out:

{% block extra_footer_script %}
<script type="text/javascript">
       $(function() {
           {% for formset in inlines %}
           $('div#FormSet{{ formset.prefix }}').formset({
               prefix: '{{ formset.prefix }}',
               formCssClass: 'dynamic-formset{{ forloop.counter }}'
           });
           {% endfor %}
       })
   </script>
{% endblock %}

If you see any errors please point them to me. Also appreciate any better ideas.

For those who want to use this - Yes it should work with any number of formsets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!