Skip to content

Commit

Permalink
Add support for Django 3.1 / django CMS 3.8 (#378)
Browse files Browse the repository at this point in the history
Drop support for Python 3.5
  • Loading branch information
yakky authored Nov 14, 2020
1 parent ba8d611 commit 5888540
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.7, 3.6, 3.5]
python-version: [3.9, 3.8, 3.7, 3.6]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
16 changes: 9 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project.

Refer to `django CMS Tutorial`_ on how to properly setup your first django CMS project.

.. warning:: Version 2.0 dropped support for Python 2.7, django CMS < 3.7 and Django < 2.2.
.. warning:: Version 2.0 dropped support for Python 2.7, 3.5, django CMS < 3.7 and Django < 2.2.
More 1.2.x versions may be released after 1.2 is out in case important bugfixes will be needed.

Usage
Expand Down Expand Up @@ -68,11 +68,13 @@ Supported versions

The current supported version matrix is the following:

+----------------+--------------+--------------+
| | Django 2.2 | Django 3.0 |
+----------------+--------------+--------------+
| django CMS 3.7 | Supported | Supported |
+----------------+--------------+--------------+
+----------------+--------------+--------------+---------------+
| | Django 2.2 | Django 3.0 | Django 3.1 |
+----------------+--------------+--------------+---------------+
| django CMS 3.7 | Supported | Supported | Not supported |
+----------------+--------------+--------------+---------------+
| django CMS 3.8 | Supported | Supported | Supported |
+----------------+--------------+--------------+---------------+

See `version 1.2`_ for older Django / django CMS versions support

Expand All @@ -93,7 +95,7 @@ might work, but are not officially supported.
Windows support
---------------

The installer is tested on Windows 7 with Python versions 3.4.2 and 2.7.8 installed using
The installer is tested on Windows 10 with Python version 3.8.6 installed using
official MSI packages available at http://python.org.

Please check that the ``.py`` extension is associated correctly with Python interpreter::
Expand Down
1 change: 1 addition & 0 deletions changes/376.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Django 3.1 / django CMS 3.8
2 changes: 2 additions & 0 deletions djangocms_installer/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ def parse(args):
requirements.extend(data.REQUIREMENTS["django-2.2"])
elif django_version == "3.0":
requirements.extend(data.REQUIREMENTS["django-3.0"])
elif django_version == "3.1":
requirements.extend(data.REQUIREMENTS["django-3.1"])

requirements.extend(data.REQUIREMENTS["default"])

Expand Down
62 changes: 35 additions & 27 deletions djangocms_installer/config/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import time

bust = {"bust": time.time()}
Expand All @@ -22,22 +21,18 @@
DJANGOCMS_RC = "https://github.com/divio/django-cms/archive/release/3.7.x.zip?{bust}".format(**bust)
DJANGOCMS_BETA = DJANGOCMS_RC
DJANGOCMS_37 = "django-cms>=3.7,<3.8"
DJANGOCMS_38 = "django-cms>=3.8,<3.9"

DJANGOCMS_SUPPORTED = ("3.7", "stable", "lts", "develop", "rc")
DJANGOCMS_STABLE = "3.7"
DJANGOCMS_LTS = "3.7"
DJANGOCMS_SUPPORTED = ("3.8", "3.7", "stable", "lts", "develop")
DJANGOCMS_STABLE = "3.8"
DJANGOCMS_LTS = "3.8"
DJANGOCMS_DEFAULT = DJANGOCMS_STABLE

DJANGO_DEVELOP = "https://github.com/django/django/archive/master.zip?{bust}".format(**bust)
DJANGO_BETA = "https://github.com/django/django/archive/master.zip?{bust}".format(**bust)
if sys.version_info >= (3, 6):
DJANGO_SUPPORTED = ("2.2", "3.0", "stable", "lts")
DJANGO_STABLE = "3.0"
DJANGO_LTS = "2.2"
else:
DJANGO_SUPPORTED = ("2.2", "stable", "lts")
DJANGO_STABLE = "2.2"
DJANGO_LTS = "2.2"
DJANGO_SUPPORTED = ("3.1", "3.0", "2.2", "stable", "lts")
DJANGO_STABLE = "3.1"
DJANGO_LTS = "2.2"

DJANGO_DEFAULT = DJANGO_STABLE

Expand All @@ -57,12 +52,14 @@
}
VERSION_MATRIX = {
"3.7": ("2.2", "3.0"),
DJANGOCMS_BETA: ("2.2", "3.0"),
DJANGOCMS_RC: ("2.2", "3.0"),
DJANGOCMS_DEVELOP: ("2.2", "3.0"),
"3.8": ("2.2", "3.0", "3.1"),
DJANGOCMS_BETA: ("2.2", "3.1"),
DJANGOCMS_RC: ("2.2", "3.1"),
DJANGOCMS_DEVELOP: ("2.2", "3.1"),
}
PACKAGE_MATRIX = {
"3.7": DJANGOCMS_37,
"3.8": DJANGOCMS_38,
DJANGOCMS_RC: DJANGOCMS_RC,
DJANGOCMS_BETA: DJANGOCMS_BETA,
DJANGOCMS_DEVELOP: DJANGOCMS_DEVELOP,
Expand All @@ -72,22 +69,34 @@
"default": ["html5lib>=1.0.1", "Pillow>=3.0", "six", "pytz"],
"django-2.2": ["django-classy-tags>=0.9", "django-sekizai>=1.0", "django-mptt>0.9"],
"django-3.0": ["django-classy-tags>=0.9", "django-sekizai>=1.0", "django-mptt>0.9"],
"cms-3.7": ["djangocms-admin-style>=1.5,<1.6", "django-treebeard>=4.0,<5.0"],
"django-3.1": ["django-classy-tags>=2.0", "django-sekizai>=2.0", "django-mptt>0.9"],
"cms-3.7": ["djangocms-admin-style>=2.0,<3.0", "django-treebeard>=4.0,<5.0"],
"cms-3.8": ["djangocms-admin-style>=2.0,<3.0", "django-treebeard>=4.0,<5.0"],
"cms-master": [
"https://github.com/divio/djangocms-admin-style/archive/master.zip?{bust}".format(**bust),
"django-treebeard>=4.0,<5.0",
],
"plugins-3.7": [
"djangocms-text-ckeditor>=3.7,<4.0",
"djangocms-link>=2.5,<2.7",
"djangocms-icon>=1.4,<1.6",
"djangocms-style>=2.2,<2.4",
"djangocms-googlemap>=1.3,<1.5",
"djangocms-snippet>=2.2,<2.4",
"djangocms-video>=2.1,<2.4",
"djangocms-file>=2.3,<2.5",
"djangocms-picture>=2.3,<2.5",
"djangocms-bootstrap4>=1.5,<1.7",
"djangocms-text-ckeditor>=4.0,<5.0",
"djangocms-link>=3.0,<4.0",
"djangocms-icon>=2.0,<3.0",
"djangocms-style>=3.0,<4.0",
"djangocms-googlemap>=2.0,<3.0",
"djangocms-video>=3.0,<4.0",
"djangocms-file>=3.0,<4.0",
"djangocms-picture>=3.0,<4.0",
"djangocms-bootstrap4>=2.0,<3.0",
],
"plugins-3.8": [
"djangocms-text-ckeditor>=4.0,<5.0",
"djangocms-link>=3.0,<4.0",
"djangocms-icon>=2.0,<3.0",
"djangocms-style>=3.0,<4.0",
"djangocms-googlemap>=2.0,<3.0",
"djangocms-video>=3.0,<4.0",
"djangocms-file>=3.0,<4.0",
"djangocms-picture>=3.0,<4.0",
"djangocms-bootstrap4>=2.0,<3.0",
],
"plugins-master": [
"https://github.com/divio/djangocms-text-ckeditor/archive/master.zip?{bust}" "".format(**bust),
Expand Down Expand Up @@ -130,7 +139,6 @@
* djangocms-file (File plugin)
* djangocms-picture (Image plugin)
* djangocms-style (Style plugin)
* djangocms-snippet (Snippet plugin)
* djangocms-googlemap (GoogleMap plugin)
* djangocms-video (Video plugin)
"""
Expand Down
1 change: 0 additions & 1 deletion djangocms_installer/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"djangocms_link",
"djangocms_picture",
"djangocms_style",
"djangocms_snippet",
"djangocms_googlemap",
"djangocms_video",
)
Expand Down
4 changes: 2 additions & 2 deletions docs/libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Libraries you would want to check:

The actual package name may vary depending on the platform / distribution you
are using; you should make sure you have the library headers file installed
(mostly contained in package with `-dev` in its name: e.g. `libjpeg-dev` for
`libjpeg` library).
(mostly contained in package with ``-dev`` in its name: e.g. ``libjpeg-dev`` for
``libjpeg`` library).

Examples
^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The following arguments can be overridden in :ref:`wizard_mode`
.. note:: Django ``stable`` keyword is expanded to latest released Django version supported by django CMS
.. note:: Django ``lts`` keyword is expanded to latest released Django LTS supported by django CMS
.. note:: django-cms ``stable`` keyword is expanded to latest released django-cms version
.. note:: django-cms ``lts`` keyword is expanded to latest released django-cms LTS version
.. note:: django-cms ``lts`` keyword is expanded to latest released django-cms LTS version, or latest stable if LTS is not supported
.. warning:: if an unsupported combination of Django and django CMS version is selected, the
wizard exits reporting the error.

Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ classifiers =
Framework :: Django,
Framework :: Django :: 2.2,
Framework :: Django :: 3.0,
Framework :: Django :: 3.1,
Topic :: Software Development

[options]
Expand Down
8 changes: 4 additions & 4 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def get_stable_django(latest=False, lts=False):
:param lts: Latest lts version
"""
if latest and not sys.version_info < (3, 6) and not lts:
dj_ver = "3.0"
match = "Django<3.1"
dj_ver = "3.1"
match = "Django<3.2"
else:
dj_ver = "2.2"
match = "Django<2.3"
Expand All @@ -137,6 +137,6 @@ def get_stable_djangocms():
Takes into account arguments and python version.
"""
dj_ver = "3.7"
match = "django-cms<3.8"
dj_ver = "3.8"
match = "django-cms<3.9"
return dj_ver, match
66 changes: 30 additions & 36 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_default_config(self):

self.assertEqual(conf_data.project_name, "example_prj")

self.assertEqual(conf_data.cms_version, "3.7")
self.assertEqual(conf_data.cms_version, "3.8")
self.assertEqual(conf_data.django_version, dj_version)
self.assertEqual(conf_data.i18n, "yes")
self.assertEqual(conf_data.reversion, "yes")
Expand Down Expand Up @@ -361,17 +361,15 @@ def test_latest_version(self):
self.assertEqual(less_than_version("3"), "3.1")
self.assertEqual(less_than_version("3.0.1"), "3.1.1")

@unittest.skipIf(sys.version_info[0] < 3, reason="django 2+ only supports python 3")
def test_supported_versions(self):
dj_version, dj_match = get_stable_django(latest=True)

self.assertEqual(supported_versions("stable", "stable"), (dj_version, "3.7"))
self.assertEqual(supported_versions("stable", "stable"), (dj_version, "3.8"))
self.assertEqual(supported_versions("stable", "3.1.10"), (dj_version, None))
self.assertEqual(supported_versions("stable", "rc"), (dj_version, data.DJANGOCMS_RC))
self.assertEqual(supported_versions("stable", "beta"), (dj_version, data.DJANGOCMS_BETA))
self.assertEqual(supported_versions("stable", "develop"), (dj_version, data.DJANGOCMS_DEVELOP))
self.assertEqual(supported_versions("lts", "rc"), ("2.2", data.DJANGOCMS_RC))
self.assertEqual(supported_versions("lts", "lts"), ("2.2", "3.7"))
self.assertEqual(supported_versions("lts", "stable"), ("2.2", "3.8"))
self.assertEqual(supported_versions("lts", "lts"), ("2.2", "3.8"))

with self.assertRaises(RuntimeError):
supported_versions("stable", "2.4"), ("1.5", "2.4")
Expand Down Expand Up @@ -405,8 +403,8 @@ def test_requirements(self):
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=3.7,<4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style>=1.5") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style>=2.0") > -1)
self.assertTrue(conf_data.requirements.find("django-filer") > -1)
self.assertTrue(conf_data.requirements.find("cmsplugin-filer") == -1)
self.assertTrue(conf_data.requirements.find("djangocms-file") > -1)
Expand All @@ -427,12 +425,12 @@ def test_requirements(self):
]
)

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_38) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("cmsplugin-filer") == -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=3.7,<4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-bootstrap4") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-file") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-flash") == -1)
Expand Down Expand Up @@ -562,7 +560,7 @@ def test_requirements(self):
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=3.7") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style") > -1)
self.assertTrue(conf_data.requirements.find("pytz") > -1)

Expand All @@ -585,7 +583,7 @@ def test_requirements(self):
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=3.7") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor>=4.0") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style") > -1)
self.assertTrue(conf_data.requirements.find("pytz") > -1)

Expand Down Expand Up @@ -672,20 +670,17 @@ def test_requirements(self):
"-p" + self.project_dir,
"example_prj",
]
if sys.version_info < (3, 5,):
with self.assertRaises(SystemExit):
conf_data = config.parse(requirements_21)
else:
conf_data = config.parse(requirements_21)

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_DEVELOP) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor") == -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style/archive/master.zip") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-teaser/archive/master.zip") == -1)
self.assertTrue(conf_data.requirements.find("south") == -1)
self.assertTrue(conf_data.requirements.find("psycopg2") > -1)

conf_data = config.parse(requirements_21)

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_DEVELOP) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)
self.assertFalse(conf_data.requirements.find("django-reversion") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-text-ckeditor") == -1)
self.assertTrue(conf_data.requirements.find("djangocms-admin-style/archive/master.zip") > -1)
self.assertTrue(conf_data.requirements.find("djangocms-teaser/archive/master.zip") == -1)
self.assertTrue(conf_data.requirements.find("south") == -1)
self.assertTrue(conf_data.requirements.find("psycopg2") > -1)

dj_version, dj_match = get_stable_django(lts=True)
conf_data = config.parse(
Expand All @@ -699,7 +694,7 @@ def test_requirements(self):
]
)

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_38) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)

dj_version, dj_match = get_stable_django(latest=True)
Expand All @@ -714,7 +709,7 @@ def test_requirements(self):
]
)

self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_37) > -1)
self.assertTrue(conf_data.requirements.find(config.data.DJANGOCMS_38) > -1)
self.assertTrue(conf_data.requirements.find(dj_match) > -1)

def test_bootstrap(self):
Expand Down Expand Up @@ -930,7 +925,6 @@ def unused(self, config_data):
if hasattr(config_data, "requirements"):
delattr(config_data, "requirements")

@unittest.skipIf(sys.version_info[0] < 3, reason="django 2+ only supports python 3")
def test_parse_config_file(self, *args):
"""Tests .config.__init__._parse_config_file function."""
dj_version, __ = get_stable_django(latest=True)
Expand All @@ -955,14 +949,14 @@ def test_parse_config_file(self, *args):
("django_version", dj_lts_version),
),
),
("config-03.ini", None, (("cms_version", "3.7"), ("i18n", "no"), ("django_version", dj_version),)),
("config-04.ini", None, (("cms_version", "3.7"), ("use_timezone", "no"))),
("config-05.ini", None, (("cms_version", "3.7"), ("timezone", "Europe/London"))),
("config-06.ini", None, (("cms_version", "3.7"), ("reversion", "no"))),
("config-03.ini", None, (("cms_version", "3.8"), ("i18n", "no"), ("django_version", dj_version),)),
("config-04.ini", None, (("cms_version", "3.8"), ("use_timezone", "no"))),
("config-05.ini", None, (("cms_version", "3.8"), ("timezone", "Europe/London"))),
("config-06.ini", None, (("cms_version", "3.8"), ("reversion", "no"))),
(
"config-07.ini",
None,
(("cms_version", "3.7"), ("permissions", "no"), ("django_version", dj_lts_version)),
(("cms_version", "3.8"), ("permissions", "no"), ("django_version", dj_lts_version)),
),
(
"config-08.ini",
Expand All @@ -973,14 +967,14 @@ def test_parse_config_file(self, *args):
"config-09.ini",
None,
(
("cms_version", "3.7"),
("cms_version", "3.8"),
("i18n", "yes"),
("languages", ["en", "ru"]),
("django_version", dj_lts_version),
),
),
("config-10.ini", "django_version", dj_lts_version),
("config-11.ini", "project_directory", "/test/me"),
("config-11.ini", None, (("project_directory", "/test/me"), ("cms_version", "3.7"))),
("config-12.ini", None, (("bootstrap", True), ("django_version", dj_lts_version))),
("config-13.ini", "templates", "."),
("config-14.ini", "starting_page", True),
Expand Down
Loading

0 comments on commit 5888540

Please sign in to comment.