From 44f902920315ec19407e97ae40965cf2e94f46e9 Mon Sep 17 00:00:00 2001 From: Josh Peng Yu Date: Wed, 6 Mar 2024 22:29:24 +0800 Subject: [PATCH] fix: fix compat (#52) --- djangocms_references/compat.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/djangocms_references/compat.py b/djangocms_references/compat.py index 31b2afd..f5d98c8 100644 --- a/djangocms_references/compat.py +++ b/djangocms_references/compat.py @@ -1,9 +1,10 @@ from cms import __version__ as cms_version -from packaging.version import Version - -DJANGO_CMS_4_1 = Version(cms_version) >= Version('4.1') +try: + from packaging.version import Version +except ModuleNotFoundError: + from distutils.version import LooseVersion as Version def is_versioning_installed(): @@ -15,4 +16,7 @@ def is_versioning_installed(): return True +DJANGO_CMS_4_1 = Version(cms_version) >= Version('4.1') + + VERSIONING_INSTALLED = is_versioning_installed()