Python version
3.12.6
Django version
5.1.1
Package version
0.22.1
Current behavior (bug description)
When has_delete_permission
is set to False
in the Django admin for my model, the Accordion functionality of django-treenode
stops working. The Accordion does not expand, and it remains with the default name without any options to expand.
from django.contrib import admin
from treenode.admin import TreeNodeModelAdmin
from treenode.forms import TreeNodeForm
from .models import Category
class CategoryAdmin(TreeNodeModelAdmin):
# set the changelist display mode: 'accordion', 'breadcrumbs' or 'indentation' (default)
# when changelist results are filtered by a querystring,
# 'breadcrumbs' mode will be used (to preserve data display integrity)
treenode_display_mode = TreeNodeModelAdmin.TREENODE_DISPLAY_MODE_ACCORDION
# treenode_display_mode = TreeNodeModelAdmin.TREENODE_DISPLAY_MODE_BREADCRUMBS
# treenode_display_mode = TreeNodeModelAdmin.TREENODE_DISPLAY_MODE_INDENTATION
# use TreeNodeForm to automatically exclude invalid parent choices
form = TreeNodeForm
def has_delete_permission(self, request, obj=None):
"""
Disallow deleting records.
"""
return False
admin.site.register(Category, CategoryAdmin)
Expected behavior
I expect that even when the delete permission is disabled, the Accordion should function normally, allowing for expansion and proper display of tree nodes.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too