Reputation: 957
I have customized template for one of my app. This template extends admin/change_form.html
.
Model has few inlines. And I need to locate each inline form on different tabs.
So this is how I have done:
{% for inline_admin_formset in inline_admin_formsets %}
<a href="javascript:void(0)" class="js-vertical-tab vertical-tab" rel="{{ inline_admin_formset.formset.prefix }}">{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</a>
{% endfor %}
{% for inline_admin_formset in inline_admin_formsets %}
<a href="" class="js-vertical-tab-accordion-heading vertical-tab-accordion-heading" rel="{{ inline_admin_formset.formset.prefix }}">{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</a>
<div id="{{ inline_admin_formset.formset.prefix }}" class="js-vertical-tab-content vertical-tab-content">
{{ inline_admin_formset.formset.management_form }}
{% include inline_admin_formset.opts.template %}
</div>
{% endfor %}
{% block inline_field_sets %}
{% endblock %}
The problem is that it saves only one record in inline forms. But if i will remove my custom for loop block, and just leave it as default everything works fine!
What did I miss?
Upvotes: 0
Views: 1568
Reputation: 957
Found out what was the problem. This line of code is redundant:
{{ inline_admin_formset.formset.management_form }}
Upvotes: 1