opened 09:38AM - 11 Aug 23 UTC
closed 07:32AM - 29 Aug 23 UTC
bug
invalid
**Python version**
3.9
**Django version**
3.2.20
**Package version**
0.… 26.0
**Current behavior (bug description)**
I'm trying to add a form for each **fieldsets as tab**, only if passed a bool, I changed the change_form.html file like this.
```
{% if show_fieldsets_as_tabs %}
{% for fieldset in adminform %}
{% with fieldset.name|default_if_none:opts.verbose_name as tab_name %}
{% if shop_custom %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}{% if form_url %}action="{{ form_url }}" {% endif %}method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
{% endif %}
<div id="tabcontent-{{ tab_name|admin_interface_slugify }}" class="tabbed-changeform-tabcontent {{ forloop.counter0|default:'active' }}">
{% include "admin/includes/headerless_fieldset.html" %}
</div>
{% if shop_custom %}
</form>
{% endif %}
{% endwith %}
{% endfor %}
{% else %}
```
There are 5 tabs, the first 4 have loot defined in fieldsets the last one doesn't:
![image](https://github.com/fabiocaccamo/django-admin-interface/assets/73225008/214b9efa-3401-4caa-91c5-12ba49246b6a)
![image](https://github.com/fabiocaccamo/django-admin-interface/assets/73225008/7462db1b-17b3-46f9-a4fa-510a8b34a6b6)
**Expected behavior**
The problem is that it creates the form in all tabs except the first one, but it creates the csrf token, which means it enters the if, but it fails to create the form I don't know why.
![image](https://github.com/fabiocaccamo/django-admin-interface/assets/73225008/74bdc9b3-d79e-470e-a822-dd6a78b680ea)
Is this issue related to the django-admin-interface library? somehow, when it goes to create the active tab it goes to delete something?
## Upvote & Fund
- We're using [Polar.sh](https://polar.sh/fabiocaccamo) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
<a href="https://polar.sh/fabiocaccamo/django-admin-interface/issues/308">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/fabiocaccamo/django-admin-interface/issues/308/pledge.svg?darkmode=1">
<img alt="Fund with Polar" src="https://polar.sh/api/github/fabiocaccamo/django-admin-interface/issues/308/pledge.svg">
</picture>
</a>
I’m trying to add a form for each fieldsets as tab , only if passed a bool, I changed the change_form.html file like this.
The problem is that it creates the form in all tabs except the first one, but it creates the csrf token, which means it enters the if, but it fails to create the form I don’t know why.