8000 Adding support for Django 2.2 LTS (#6655) · FinalAngel/django-cms@bf95a46 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf95a46

Browse files
vthaianFinalAngel
authored andcommitted
Adding support for Django 2.2 LTS (django-cms#6655)
* New changes for cms 3.7 * Fix typo * Fixed issue with force_color * Removed unused import * Added docs to index.rst * Fixed travis jobs * Fixed force_color command * Changes after review * Fixed django version in setup * Update django-2.2.txt
1 parent eeb1e47 commit bf95a46

File tree

10 files changed

+130
-11
lines changed

10 files changed

+130
-11
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,24 @@ matrix:
8383
env: DJANGO=2.1 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='customuserapp.User'
8484
- python: 3.6
8585
env: TEST_DOCS=1 DJANGO=2.1 DATABASE_URL='sqlite://localhost/:memory:'
86+
87+
# DJANGO 2.2
88+
- python: 3.5
89+
env: DJANGO=2.2 DATABASE_URL='sqlite://localhost/:memory:'
90+
dist: xenial
91+
sudo: true
92+
- python: 3.5
93+
env: DJANGO=2.2 DATABASE_URL='mysql://root@127.0.0.1/djangocms_test'
94+
- python: 3.6
95+
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test'
96+
- python: 3.6
97+
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='emailuserapp.EmailUser'
98+
- python: 3.6
99+
env: DJANGO=2.2 DATABASE_URL='postgres://postgres@127.0.0.1/djangocms_test' AUTH_USER_MODEL='customuserapp.User'
100+
- python: 3.6
101+
env: TEST_DOCS=1 DJANGO=2.2 DATABASE_URL='sqlite://localhost/:memory:'
102+
dist: xenial
103+
sudo: true
86104
allow_failures:
87105
- python: 2.7
88106
env: DJANGO=1.11 DATABASE_URL='sqlite://localhost/:memory:'

CHANGELOG.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
=== 3.7.0 (unreleased) ===
2+
3+
* Introduced Django 2.2 support.
4+
5+
16
=== 3.6.0 (2019-01-29) ===
27

38
* Removed the ``cms moderator`` command.

cms/management/commands/subcommands/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from collections import OrderedDict
66

77
from django.core.management.base import BaseCommand, CommandParser
8-
from django.core.management.color import no_style
8+
from django.core.management.color import no_style, color_style
99

10-
from cms.utils.compat import DJANGO_2_0
10+
from cms.utils.compat import DJANGO_2_0, DJANGO_2_2
1111

1212

1313
def add_builtin_arguments(parser):
@@ -37,6 +37,9 @@ def add_builtin_arguments(parser):
3737
help='Raise on CommandError exceptions')
3838
parser.add_argument('--no-color', action='store_true', dest='no_color', default=False,
3939
help="Don't colorize the command output.")
40+
if DJANGO_2_2:
41+
parser.add_argument('--force-color', action='store_true', dest='force_color', default=False,
42+
help="Colorize the command output.")
4043

4144

4245
class SubcommandsCommand(BaseCommand):
@@ -85,6 +88,8 @@ def handle(self, *args, **options):
8588
if options.get('no_color'):
8689
command.style = no_style()
8790
command.stderr.style_func = None
91+
if DJANGO_2_2 and options.get('force_color'):
92+
command.style = color_style(force_color=True)
8893
if options.get('stdout'):
8994
command.stdout._out = options.get('stdout')
9095
if options.get('stderr'):

cms/test_utils/util/context_managers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __enter__(self):
2626
def __exit__(self, type, value, traceback):
2727
setattr(sys, 'std%s' % self.std, getattr(sys, '__std%s__' % self.std))
2828

29+
2930
class StdoutOverride(StdOverride):
3031
"""
3132
This overrides Python's the standard output and redirects it to a StringIO

cms/tests/test_publisher.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_command_line_publishes_zero_pages_on_empty_db(self):
3939
with StdoutOverride() as buffer:
4040
# Now we don't expect it to raise, but we need to redirect IO
4141
call_command('cms', 'publisher-publish')
42-
lines = buffer.getvalue().split('\n') #NB: readlines() doesn't work
42+
lines = buffer.getvalue().split('\n') # NB: readlines() doesn't work
4343

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

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

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

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

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

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

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

315315
for line in lines:
316316
if 'Total' in line:

cms/utils/compat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
DJANGO_1_11 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.0')
1515
DJANGO_2_0 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.1')
1616
DJANGO_2_1 = LooseVersion(DJANGO_VERSION) < LooseVersion('2.2')
17+
DJANGO_2_2 = LooseVersion(DJANGO_VERSION) < LooseVersion('3.0')

docs/upgrade/3.7.rst

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
.. _upgrade-to-3.7.0:
2+
3+
###################
4+
3.7.0 release notes
5+
###################
6+
7+
This release of django CMS concentrates on introducing support for Django 2.2 LTS.
8+
9+
10+
*******************
11+
What's new in 3.7.0
12+
*******************
13+
14+
Improvements and new features
15+
=============================
16+
17+
* introduced support for Django 2.2
18+
19+
20+
*********************
21+
How to upgrade to 3.7
22+
*********************
23+
24+
We assume you are upgrading from django CMS 3.6.
25+
26+
Please make sure that your current database is consistent and in a healthy
27+
state, and **make a copy of the database before proceeding further.**
28+
29+
Then run::
30+
31+
python manage.py migrate # to ensure that your database is up-to-date with migrations
32+
python manage.py cms fix-tree
33+
34+
Check custom code and third-party applications for use of deprecated or removed functionality or
35+
APIs (see above). Some third-party components may need to be updated.
36+
37+
Install the new version of django CMS from GitHub or via pip.
38+
39+
Run::
40+
41+
python manage.py migrate
42+
43+
to apply the new migrations.
44+
45+
46+
***********************************
47+
Create a new django CMS 3.7 project
48+
***********************************
49+
50+
On the Divio Cloud
51+
==================
52+
53+
The Divio Cloud offers an easy way to set up django CMS projects. In the `Divio Cloud Control Panel
54+
<https://control.divio.com>`_, create a new django CMS project and **Deploy** it.
55+
56+
57+
Using the django CMS Installer
58+
==============================
59+
60+
.. note::
61+
62+
The django CMS Installer is not yet available for django CMS 3.6 or Django 2 or later.
63+
64+
This section will be updated or removed before the final release of django CMS 3.6.
65+
66+
67+
****************************
68+
Contributors to this release
69+
****************************
70+
71+
* Daniele Procida
72+
* Vadim Sikora
73+
* Paulo Alvarado
74+
* Bartosz Płóciennik
75+
* Katie McLaughlin
76+
* Krzysztof Socha
77+
* Mateusz Kamycki
78+
* Sergey Fedoseev
79+
* Aliaksei Urbanski
80+
* heppstux
81+
* Chematronix
82+
* Frank
83+
* Jacob Rief
84+
* Julz

docs/upgrade/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ makes changes to your database.
1313
.. toctree::
1414
:maxdepth: 1
1515

16+
3.7
1617
3.6
1718
3.5.3
1819
3.5.2

setup.py

+3Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
'Programming Language :: Python :: 3.4',
1919
'Programming Language :: Python :: 3.5',
2020
'Programming Language :: Python :: 3.6',
21+
'Programming Language :: Python :: 3.7',
2122
'Framework :: Django',
2223
'Framework :: Django :: 1.11',
2324
'Framework :: Django :: 2.0',
2425
'Framework :: Django :: 2.1',
26+
'Framework :: Django :: 2.2',
2527
]
2628

2729
INSTALL_REQUIREMENTS = [
28-
'Django>=1.11,<2.2',
30+
'Django>=1.11,<3.0',
2931
'django-classy-tags>=0.7.2',
3032
'django-formtools>=2.1',
3133
'django-treebeard>=4.3',

test_requirements/django-2.2.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-r requirements_base.txt
2+
Django>=2.2,<3.0

0 commit comments

Comments
 (0)
0