diff --git a/cms/cms_toolbars.py b/cms/cms_toolbars.py index 1d27b5e81f3..069edaac863 100644 --- a/cms/cms_toolbars.py +++ b/cms/cms_toolbars.py @@ -17,6 +17,7 @@ from cms.toolbar_pool import toolbar_pool from cms.utils import get_language_from_request, page_permissions from cms.utils.conf import get_cms_setting +from cms.utils.compat import DJANGO_5_0 from cms.utils.i18n import get_language_dict, get_language_tuple from cms.utils.page_permissions import user_can_change_page, user_can_delete_page, user_can_publish_page from cms.utils.urlutils import add_url_parameters, admin_reverse @@ -225,7 +226,7 @@ def add_logout_button(self, parent): action=admin_reverse('logout'), active=True, on_success=on_success, - method='GET', + method='GET' if not DJANGO_5_0 else 'POST', ) def add_language_menu(self): diff --git a/cms/models/pluginmodel.py b/cms/models/pluginmodel.py index 48876d1b504..0d84f09dfbd 100644 --- a/cms/models/pluginmodel.py +++ b/cms/models/pluginmodel.py @@ -80,6 +80,10 @@ def __new__(cls, name, bases, attrs): # if there is a RenderMeta in attrs, use this one # else try to use the one from the superclass (if present) meta = attr_meta or getattr(new_class, '_render_meta', None) + treebeard_view_fields = (f for f in new_class._meta.fields + if f.name in ('depth', 'numchild', 'path')) + for field in treebeard_view_fields: + field.editable = False # set a new BoundRenderMeta to prevent leaking of state new_class._render_meta = BoundRenderMeta(meta) return new_class diff --git a/cms/tests/test_forms.py b/cms/tests/test_forms.py index fd850572840..f764f40cb63 100644 --- a/cms/tests/test_forms.py +++ b/cms/tests/test_forms.py @@ -13,7 +13,7 @@ ViewRestrictionInlineAdminForm, ) from cms.api import assign_user_to_page, create_page, create_title -from cms.forms.fields import PageSelectFormField, SuperLazyIterator +from cms.forms.fields import LazyChoiceField, PageSelectFormField, SuperLazyIterator from cms.forms.utils import get_page_choices, get_site_choices, update_site_and_page_choices from cms.forms.widgets import ApplicationConfigSelect from cms.models import ACCESS_PAGE, ACCESS_PAGE_AND_CHILDREN diff --git a/cms/tests/test_toolbar.py b/cms/tests/test_toolbar.py index dc54bccb1f1..ad506949a85 100644 --- a/cms/tests/test_toolbar.py +++ b/cms/tests/test_toolbar.py @@ -40,7 +40,7 @@ from cms.toolbar.items import AjaxItem, Break, ItemSearchResult, LinkItem, SubMenu, ToolbarAPIMixin from cms.toolbar.toolbar import CMSToolbar from cms.toolbar_pool import toolbar_pool -from cms.utils.compat import DJANGO_4_2 +from cms.utils.compat import DJANGO_4_2, DJANGO_5_0 from cms.utils.conf import get_cms_setting from cms.utils.i18n import get_language_tuple from cms.utils.urlutils import admin_reverse @@ -641,7 +641,10 @@ def test_hide_toolbar_login_nonstaff(self): def test_admin_logout_staff(self): with override_settings(CMS_PERMISSION=True): with self.login_user_context(self.get_staff()): - response = self.client.get('/en/admin/logout/') + if DJANGO_5_0: + response = self.client.post('/en/admin/logout/') + else: + response = self.client.get('/en/admin/logout/') self.assertEqual(response.status_code, 200) def test_show_toolbar_without_edit(self): diff --git a/cms/utils/compat/__init__.py b/cms/utils/compat/__init__.py index cf42b692ac9..085512f83b6 100644 --- a/cms/utils/compat/__init__.py +++ b/cms/utils/compat/__init__.py @@ -14,3 +14,4 @@ DJANGO_3 = Version(DJANGO_VERSION) < Version('4.0') DJANGO_4_1 = Version(DJANGO_VERSION) < Version('4.2') DJANGO_4_2 = Version(DJANGO_VERSION) < Version('4.3') +DJANGO_5_0 = Version(DJANGO_VERSION) < Version('5.1')