From 31577f92916f42918d8cbf0db33dcce64d1e2649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E7=9D=BF=E6=9B=BC?= Date: Tue, 29 Oct 2024 14:48:34 +0800 Subject: [PATCH] change menuitem inherit class. --- djangocms_navigation/admin.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/djangocms_navigation/admin.py b/djangocms_navigation/admin.py index 082fd8a30..8471dcf43 100644 --- a/djangocms_navigation/admin.py +++ b/djangocms_navigation/admin.py @@ -27,8 +27,6 @@ from djangocms_versioning.models import Version from treebeard.admin import TreeAdmin -from cms.admin.utils import ChangeListActionsMixin - from .compat import TREEBEARD_4_5 from .conf import TREE_MAX_RESULT_PER_PAGE_COUNT from .filters import LanguageFilter @@ -41,12 +39,16 @@ from .compat import CMS_41 +menuitem_admin_class = [TreeAdmin] + try: if CMS_41: + from cms.admin.utils import ChangeListActionsMixin from djangocms_versioning.helpers import ( content_is_unlocked_for_user, version_is_locked, ) + menuitem_admin_class.insert(0, ChangeListActionsMixin) else: from djangocms_version_locking.helpers import ( content_is_unlocked_for_user, @@ -55,8 +57,7 @@ using_version_lock = True LOCK_MESSAGE = _( - "The item is currently locked or you don't " - "have permission to change it" + "The item is currently locked or you don't have permission to change it" ) except ImportError: using_version_lock = False @@ -276,7 +277,7 @@ def get_menuitem_link(self, obj): @admin.register(MenuItem) -class MenuItemAdmin(ChangeListActionsMixin, TreeAdmin): +class MenuItemAdmin(*menuitem_admin_class): form = MenuItemForm menu_content_model = MenuContent menu_model = Menu