Skip to content

Commit

Permalink
Remove useless DJANGO_5_0 compat variable
Browse files Browse the repository at this point in the history
  • Loading branch information
protoroto committed Dec 20, 2023
1 parent 1e10963 commit 0bb246b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cms/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
from cms.utils import get_language_from_request, page_permissions
from cms.utils.compat import DJANGO_5_0
from cms.utils.compat import DJANGO_4_2
from cms.utils.conf import get_cms_setting
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
Expand Down Expand Up @@ -226,7 +226,7 @@ def add_logout_button(self, parent):
action=admin_reverse('logout'),
active=True,
on_success=on_success,
method='GET' if not DJANGO_5_0 else 'POST',
method='GET' if DJANGO_4_2 else 'POST',
)

def add_language_menu(self):
Expand Down
8 changes: 4 additions & 4 deletions cms/tests/test_toolbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, DJANGO_5_0
from cms.utils.compat import DJANGO_4_2
from cms.utils.conf import get_cms_setting
from cms.utils.i18n import get_language_tuple
from cms.utils.urlutils import admin_reverse
Expand Down Expand Up @@ -641,10 +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()):
if DJANGO_5_0:
response = self.client.post('/en/admin/logout/')
else:
if DJANGO_4_2:
response = self.client.get('/en/admin/logout/')
else:
response = self.client.post('/en/admin/logout/')
self.assertEqual(response.status_code, 200)

def test_show_toolbar_without_edit(self):
Expand Down
5 changes: 2 additions & 3 deletions cms/utils/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
DJANGO_2_2 = Version(DJANGO_VERSION) < Version('3.0')
DJANGO_3_0 = Version(DJANGO_VERSION) < Version('3.1')
DJANGO_3_1 = Version(DJANGO_VERSION) < Version('3.2')
DJANGO_3_2 = Version(DJANGO_VERSION) < Version('3.3')
DJANGO_3 = Version(DJANGO_VERSION) < Version('4.0')
DJANGO_3_2 = Version(DJANGO_VERSION) < Version('4.0')
DJANGO_3 = DJANGO_3_2
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')

0 comments on commit 0bb246b

Please sign in to comment.