Selaa lähdekoodia

Upgrade Wagtail 2.11 (#375)

* Update wagtail and django versions
* Change classname to form_classname for blocks
* Update CSS and fill in locale on migrations
* Fix submenu item styling on mobile
* Change migrations and remove middleware from test class
* Remove support for 3.5 and add support for 3.9
JorneVL 4 vuotta sitten
vanhempi
commit
77c433062b

+ 2 - 2
azure-pipelines.yml

@@ -31,14 +31,14 @@ stages:
       vmImage: 'ubuntu-latest'
     strategy:
       matrix:
-        py3.5:
-          PYTHON_VERSION: '3.5'
         py3.6:
           PYTHON_VERSION: '3.6'
         py3.7:
           PYTHON_VERSION: '3.7'
         py3.8:
           PYTHON_VERSION: '3.8'
+        py3.9:
+          PYTHON_VERSION: '3.9'
 
     steps:
     - task: UsePythonVersion@0

+ 4 - 4
coderedcms/blocks/__init__.py

@@ -76,7 +76,7 @@ HTML_STREAMBLOCKS = [
     ('button', ButtonBlock()),
     ('image', ImageBlock()),
     ('image_link', ImageLinkBlock()),
-    ('html', blocks.RawHTMLBlock(icon='code', classname='monospace', label=_('HTML'), )),
+    ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'), )),
     ('download', DownloadBlock()),
     ('embed_video', EmbedVideoBlock()),
     ('quote', QuoteBlock()),
@@ -103,7 +103,7 @@ NAVIGATION_STREAMBLOCKS = [
 
 BASIC_LAYOUT_STREAMBLOCKS = [
     ('row', GridBlock(HTML_STREAMBLOCKS)),
-    ('html', blocks.RawHTMLBlock(icon='code', classname='monospace', label=_('HTML'))),
+    ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
 ]
 
 LAYOUT_STREAMBLOCKS = [
@@ -112,13 +112,13 @@ LAYOUT_STREAMBLOCKS = [
         ('cardgrid', CardGridBlock([
             ('card', CardBlock()),
         ])),
-        ('html', blocks.RawHTMLBlock(icon='code', classname='monospace', label=_('HTML'))),
+        ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
     ])),
     ('row', GridBlock(CONTENT_STREAMBLOCKS)),
     ('cardgrid', CardGridBlock([
         ('card', CardBlock()),
     ])),
-    ('html', blocks.RawHTMLBlock(icon='code', classname='monospace', label=_('HTML'))),
+    ('html', blocks.RawHTMLBlock(icon='code', form_classname='monospace', label=_('HTML'))),
 ]
 
 STREAMFORM_FIELDBLOCKS = [

+ 1 - 1
coderedcms/blocks/metadata_blocks.py

@@ -81,7 +81,7 @@ class StructuredDataActionBlock(blocks.StructBlock):
     extra_json = blocks.RawHTMLBlock(
         required=False,
         verbose_name=_('Additional action markup'),
-        classname='monospace',
+        form_classname='monospace',
         help_text=_(
             "Additional JSON-LD inserted into the Action dictionary. Must be properties of https://schema.org/Action."  # noqa
         )

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
coderedcms/project_template/basic/website/migrations/0001_initial.py


+ 4 - 1
coderedcms/project_template/basic/website/migrations/0002_initial_data.py

@@ -5,6 +5,8 @@ from __future__ import unicode_literals
 from django import VERSION as DJANGO_VERSION
 from django.db import migrations
 
+from wagtail.core.models import Locale
+
 
 def initial_data(apps, schema_editor):
     ContentType = apps.get_model('contenttypes.ContentType')
@@ -31,6 +33,7 @@ def initial_data(apps, schema_editor):
         depth=2,
         numchild=0,
         url_path='/home/',
+        locale_id=Locale.get_default().id,
     )
 
     # Create a new default site
@@ -46,7 +49,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         ('coderedcms', '0001_initial'),
-        ('wagtailcore', '0002_initial_data'),
+        ('wagtailcore', '0057_page_locale_fields_notnull'),
         ('website', '0001_initial'),
     ]
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
coderedcms/project_template/sass/website/migrations/0001_initial.py


+ 4 - 1
coderedcms/project_template/sass/website/migrations/0002_initial_data.py

@@ -5,6 +5,8 @@ from __future__ import unicode_literals
 from django import VERSION as DJANGO_VERSION
 from django.db import migrations
 
+from wagtail.core.models import Locale
+
 
 def initial_data(apps, schema_editor):
     ContentType = apps.get_model('contenttypes.ContentType')
@@ -31,6 +33,7 @@ def initial_data(apps, schema_editor):
         depth=2,
         numchild=0,
         url_path='/home/',
+        locale_id=Locale.get_default().id,
     )
 
     # Create a new default site
@@ -46,7 +49,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         ('coderedcms', '0001_initial'),
-        ('wagtailcore', '0002_initial_data'),
+        ('wagtailcore', '0057_page_locale_fields_notnull'),
         ('website', '0001_initial'),
     ]
 

+ 1 - 5
coderedcms/static/coderedcms/css/codered-admin.css

@@ -220,10 +220,7 @@ input[type='checkbox']::before, input[type='radio']::before {
     font-size: 1.1em;
 }
 .nav-submenu .menu-item a {
-    padding: 0.6em 0 0.6em 2em;
-}
-.nav-submenu .menu-item a::before {
-    margin-left:0;
+    padding: 0.6em 0 0.6em 3.5em;
 }
 
 .nav-main .account:hover, .nav-main .account:focus {
@@ -241,7 +238,6 @@ input[type='checkbox']::before, input[type='radio']::before {
         width: 220px;
     }
     li.submenu-active .nav-submenu a {
-        padding-left:1em;
         width:100%;
     }
     .nav-submenu h2, .nav-submenu ul {

+ 0 - 1
coderedcms/tests/settings.py

@@ -83,7 +83,6 @@ MIDDLEWARE = [
     # 'django.middleware.common.BrokenLinkEmailsMiddleware',
 
     # CMS functionality
-    'wagtail.core.middleware.SiteMiddleware',
     'wagtail.contrib.redirects.middleware.RedirectMiddleware',
 
     # Fetch from cache. Must be LAST.

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 3
coderedcms/tests/testapp/migrations/0001_initial.py


+ 3 - 0
coderedcms/tests/testapp/migrations/0002_initial.py

@@ -5,6 +5,8 @@ from __future__ import unicode_literals
 from django import VERSION as DJANGO_VERSION
 from django.db import migrations
 
+from wagtail.core.models import Locale
+
 
 def initial_data(apps, schema_editor):
     ContentType = apps.get_model('contenttypes.ContentType')
@@ -31,6 +33,7 @@ def initial_data(apps, schema_editor):
         depth=2,
         numchild=0,
         url_path='/home/',
+        locale_id=Locale.get_default().id,
     )
 
     # Create a new default site

+ 3 - 3
setup.py

@@ -27,7 +27,6 @@ setup(
         'Operating System :: OS Independent',
         'Programming Language :: Python',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
@@ -35,6 +34,7 @@ setup(
         'Framework :: Django',
         'Framework :: Django :: 2.2',
         'Framework :: Django :: 3.0',
+        'Framework :: Django :: 3.1',
         'Framework :: Wagtail',
         'Framework :: Wagtail :: 2',
         'Topic :: Internet :: WWW/HTTP',
@@ -45,10 +45,10 @@ setup(
         'beautifulsoup4>=4.8,<4.9',     # should be the same as wagtail
         'django-eventtools==1.0.*',
         'django-bootstrap4>=1.0,<2.3',  # Version 2.0 only supports Python 3.6 and up.
-        'Django>2.1,<3.1',              # should be the same as wagtail
+        'Django>2.1,<3.2',              # should be the same as wagtail
         'geocoder==1.38.*',
         'icalendar==4.0.*',
-        'wagtail==2.9.*',
+        'wagtail==2.11.*',
         'wagtailfontawesome>=1.2.*',
         'wagtail-cache==1.*',
         'wagtail-import-export>=0.2,<0.3'

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 3
tutorial/mysite/website/migrations/0001_initial.py


+ 4 - 1
tutorial/mysite/website/migrations/0002_initial_data.py

@@ -5,6 +5,8 @@ from __future__ import unicode_literals
 from django import VERSION as DJANGO_VERSION
 from django.db import migrations
 
+from wagtail.core.models import Locale
+
 
 def initial_data(apps, schema_editor):
     ContentType = apps.get_model('contenttypes.ContentType')
@@ -31,6 +33,7 @@ def initial_data(apps, schema_editor):
         depth=2,
         numchild=0,
         url_path='/home/',
+        locale_id=Locale.get_default().id,
     )
 
     # Create a new default site
@@ -46,7 +49,7 @@ class Migration(migrations.Migration):
 
     dependencies = [
         ('coderedcms', '0001_initial'),
-        ('wagtailcore', '0002_initial_data'),
+        ('wagtailcore', '0057_page_locale_fields_notnull'),
         ('website', '0001_initial'),
     ]
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä