0

I'm experiencing an issue with the "delete" functionality in my Django admin inline formset. I have a custom template for rendering the formset, and I've added a element with the class "delete" to allow users to delete rows. However, the delete functionality doesn't seem to be working as expected.

tabular.html

{% load i18n admin_urls static admin_modify %}
<div class="js-inline-admin-formset inline-group" id="{{ inline_admin_formset.formset.prefix }}-group" data-inline-type="tabular" data-inline-formset="{{ inline_admin_formset.inline_formset_data }}">
    <!-- ... -->
    <table class="table table-centered table-nowrap mb-0 rounded inline">
        <thead class="thead-light">
            <tr>
                <th class="original"></th>
                <!-- ... -->
                {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
                    <th>{% translate "Delete?" %}</th>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for inline_admin_form in inline_admin_formset %}
                <!-- ... -->
                <tr class="form-row {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}{% if forloop.last and inline_admin_formset.has_add_permission %}empty-form{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
                    <td class="original">
                        <!-- ... -->
                    </td>
                    <!-- ... -->
                    {% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
                        <td class="delete">
                            {% if inline_admin_form.original %}
                                {{ inline_admin_form.deletion_field.field }}
                            {% endif %}
                        </td>
                    {% endif %}
                </tr>
            {% endfor %}
        </tbody>
    </table>
    <!-- ... -->
</div>

Image Preview of the issue I suspect that there might be missing JavaScript or CSS code that handles the delete functionality. However, I have noticed that when I disable the "admin_datta" app in my INSTALLED_APPS setting, the delete functionality works fine. Here's the updated INSTALLED_APPS configuration:

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    # Third Party
    "compressor",
    "sass_processor",
    "admin_datta.apps.AdminDattaConfig",# this app has some issues
    # Mine
    "students.apps.StudentsConfig",
    "academics.apps.AcademicsConfig",
]

Disabling the "admin_datta" app resolves the issue, but I would like to continue using it. Can someone help me understand how to fix the delete functionality while keeping the "admin_datta" app enabled? Any insights, guidance, or suggestions would be greatly appreciated.

Github of the app with issue https://github.com/app-generator/django-admin-datta

0 Answers0