Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Django 2.2 LTS #6655

Merged
Merged
18 changes: 18 additions & 0 deletions .travis.yml
Expand Up @@ -83,6 +83,24 @@ matrix:
env: DJANGO=2.1 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='customuserapp.User'
- python: 3.6
env: TEST_DOCS=1 DJANGO=2.1 DATABASE_URL='sqlite://localhost/:memory:'

# DJANGO 2.2
- python: 3.5
env: DJANGO=2.2 DATABASE_URL='sqlite://localhost/:memory:'
dist: xenial
sudo: true
- python: 3.5
env: DJANGO=2.2 DATABASE_URL='mysql://root@127.0.0.1/djangocms_test'
- python: 3.6
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test'
- python: 3.6
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='emailuserapp.EmailUser'
- python: 3.6
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='customuserapp.User'
- python: 3.6
env: TEST_DOCS=1 DJANGO=2.2 DATABASE_URL='sqlite://localhost/:memory:'
dist: xenial
sudo: true
allow_failures:
- python: 2.7
env: DJANGO=1.11 DATABASE_URL='sqlite://localhost/:memory:'
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.txt
@@ -1,3 +1,8 @@
=== 3.7.0 (unreleased) ===

* Introduced Django 2.2 support.


=== 3.6.0 (2019-01-29) ===

* Removed the ``cms moderator`` command.
Expand Down
9 changes: 7 additions & 2 deletions cms/management/commands/subcommands/base.py
Expand Up @@ -5,9 +5,9 @@
from collections import OrderedDict

from django.core.management.base import BaseCommand, CommandParser
from django.core.management.color import no_style
from django.core.management.color import no_style, color_style

from cms.utils.compat import DJANGO_2_0
from cms.utils.compat import DJANGO_2_0, DJANGO_2_2


def add_builtin_arguments(parser):
Expand Down Expand Up @@ -37,6 +37,9 @@ def add_builtin_arguments(parser):
help='Raise on CommandError exceptions')
parser.add_argument('--no-color', action='store_true', dest='no_color', default=False,
help="Don't colorize the command output.")
if DJANGO_2_2:
parser.add_argument('--force-color', action='store_true', dest='force_color', default=False,
help="Colorize the command output.")


class SubcommandsCommand(BaseCommand):
Expand Down Expand Up @@ -85,6 +88,8 @@ def handle(self, *args, **options):
if options.get('no_color'):
command.style = no_style()
command.stderr.style_func = None
if DJANGO_2_2 and options.get('force_color'):
command.style = color_style(force_color=True)
if options.get('stdout'):
command.stdout._out = options.get('stdout')
if options.get('stderr'):
Expand Down
1 change: 1 addition & 0 deletions cms/test_utils/util/context_managers.py
Expand Up @@ -26,6 +26,7 @@ def __enter__(self):
def __exit__(self, type, value, traceback):
setattr(sys, 'std%s' % self.std, getattr(sys, '__std%s__' % self.std))


class StdoutOverride(StdOverride):
"""
This overrides Python's the standard output and redirects it to a StringIO
Expand Down
16 changes: 8 additions & 8 deletions cms/tests/test_publisher.py
Expand Up @@ -39,7 +39,7 @@ def test_command_line_publishes_zero_pages_on_empty_db(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish')
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand All @@ -62,7 +62,7 @@ def test_command_line_ignores_draft_page(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish')
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand All @@ -87,7 +87,7 @@ def test_command_line_publishes_draft_page(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish', include_unpublished=True)
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down Expand Up @@ -118,7 +118,7 @@ def test_command_line_publishes_selected_language(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish', language='de')
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_command_line_publishes_selected_language_drafts(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish', language='de', include_unpublished=True)
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_command_line_publishes_one_page(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish')
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down Expand Up @@ -279,7 +279,7 @@ def test_command_line_publish_one_site(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish', site=siteB.id)
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down Expand Up @@ -310,7 +310,7 @@ def test_command_line_publish_multiple_languages_check_count(self):
with StdoutOverride() as buffer:
# Now we don't expect it to raise, but we need to redirect IO
call_command('cms', 'publisher-publish')
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work

for line in lines:
if 'Total' in line:
Expand Down
1 change: 1 addition & 0 deletions cms/utils/compat/__init__.py
Expand Up @@ -14,3 +14,4 @@
DJANGO_1_11 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.0')
DJANGO_2_0 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.1')
DJANGO_2_1 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.2')
DJANGO_2_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.0')
84 changes: 84 additions & 0 deletions docs/upgrade/3.7.rst
@@ -0,0 +1,84 @@
.. _upgrade-to-3.7.0:

###################
3.7.0 release notes
###################

This release of django CMS concentrates on introducing support for Django 2.2 LTS.


*******************
What's new in 3.7.0
*******************

Improvements and new features
=============================

* introduced support for Django 2.2


*********************
How to upgrade to 3.7
*********************

We assume you are upgrading from django CMS 3.6.

Please make sure that your current database is consistent and in a healthy
state, and **make a copy of the database before proceeding further.**

Then run::

python manage.py migrate # to ensure that your database is up-to-date with migrations
python manage.py cms fix-tree

Check custom code and third-party applications for use of deprecated or removed functionality or
APIs (see above). Some third-party components may need to be updated.

Install the new version of django CMS from GitHub or via pip.

Run::

python manage.py migrate

to apply the new migrations.


***********************************
Create a new django CMS 3.7 project
***********************************

On the Divio Cloud
==================

The Divio Cloud offers an easy way to set up django CMS projects. In the `Divio Cloud Control Panel
<https://control.divio.com>`_, create a new django CMS project and **Deploy** it.


Using the django CMS Installer
==============================

.. note::

The django CMS Installer is not yet available for django CMS 3.6 or Django 2 or later.

This section will be updated or removed before the final release of django CMS 3.6.


****************************
Contributors to this release
****************************

* Daniele Procida
* Vadim Sikora
* Paulo Alvarado
* Bartosz Płóciennik
* Katie McLaughlin
* Krzysztof Socha
* Mateusz Kamycki
* Sergey Fedoseev
* Aliaksei Urbanski
* heppstux
* Chematronix
* Frank
* Jacob Rief
* Julz
1 change: 1 addition & 0 deletions docs/upgrade/index.rst
Expand Up @@ -13,6 +13,7 @@ makes changes to your database.
.. toctree::
:maxdepth: 1

3.7
3.6
3.5.3
3.5.2
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -18,14 +18,16 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
]

INSTALL_REQUIREMENTS = [
'Django>=1.11,<2.2',
'Django>=1.11,<3.0',
'django-classy-tags>=0.7.2',
'django-formtools>=2.1',
'django-treebeard>=4.3',
Expand Down
2 changes: 2 additions & 0 deletions test_requirements/django-2.2.txt
@@ -0,0 +1,2 @@
-r requirements_base.txt
Django>=2.2,<3.0