Upgrade to Wagtail 3.0

This commit is contained in:
Daniel Egger 2022-06-07 18:16:53 +02:00
parent d02afcf501
commit 3a9ad53e7a
14 changed files with 33 additions and 119 deletions

View File

@ -1,2 +1,2 @@
nodejs 16.10.0
python 3.10.0
python 3.10.5

View File

@ -2,10 +2,9 @@
Base settings to build other settings files upon.
"""
import logging
from pathlib import Path
import structlog
from environs import Env
from pathlib import Path
from vbv_lernwelt.core.utils import structlog_add_app_info
@ -82,6 +81,7 @@ THIRD_PARTY_APPS = [
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.contrib.styleguide',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
@ -90,7 +90,7 @@ THIRD_PARTY_APPS = [
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',
'wagtail.locales',
'wagtail.api.v2',
@ -222,15 +222,6 @@ WAGTAILSEARCH_BACKENDS = {
}
}
# Wagtails Grapple Config:
GRAPHENE = {"SCHEMA": "grapple.schema.schema"}
GRAPPLE = {
"APPS": ["learnpath"],
"EXPOSE_GRAPHIQL" : True
}
# TEMPLATES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#templates

View File

@ -7,11 +7,10 @@ from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, path, re_path
from django.views import defaults as default_views
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from grapple import urls as grapple_urls
from ratelimit.exceptions import Ratelimited
from rest_framework.authtoken.views import obtain_auth_token
from wagtail import urls as wagtail_urls
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from vbv_lernwelt.core.middleware.auth import django_view_authentication_exempt
@ -63,7 +62,6 @@ urlpatterns += [
path("auth-token/", obtain_auth_token),
path("api/schema/", SpectacularAPIView.as_view(), name="api-schema"),
path("api/docs/", SpectacularSwaggerView.as_view(url_name="api-schema"), name="api-docs",),
path("", include(grapple_urls)),
]
if settings.APP_ENVIRONMENT != 'production':

View File

@ -4,7 +4,6 @@ Werkzeug[watchdog] # https://github.com/pallets/werkzeug
ipdb # https://github.com/gotcha/ipdb
watchgod # https://github.com/samuelcolvin/watchgod
pip-tools
pip<22
# Testing
# ------------------------------------------------------------------------------

View File

@ -4,8 +4,6 @@
#
# pip-compile --output-file=requirements-dev.txt requirements-dev.in
#
aniso8601==7.0.0
# via graphene
anyascii==0.3.1
# via wagtail
anyio==3.5.0
@ -80,7 +78,7 @@ distlib==0.3.4
# via virtualenv
dj-database-url==0.5.0
# via -r requirements.in
django==3.2.12
django==3.2.13
# via
# -r requirements.in
# django-cors-headers
@ -89,6 +87,8 @@ django==3.2.12
# django-filter
# django-htmx
# django-model-utils
# django-modelcluster
# django-permissionedforms
# django-redis
# django-stubs
# django-stubs-ext
@ -96,9 +96,7 @@ django==3.2.12
# django-treebeard
# djangorestframework
# drf-spectacular
# graphene-django
# wagtail
# wagtail-grapple
django-click==2.3.0
# via -r requirements.in
django-cors-headers==3.11.0
@ -117,7 +115,9 @@ django-ipware==4.0.2
# via -r requirements.in
django-model-utils==4.2.0
# via -r requirements.in
django-modelcluster==5.3
django-modelcluster==6.0
# via wagtail
django-permissionedforms==0.1
# via wagtail
django-ratelimit==3.0.1
# via -r requirements.in
@ -170,18 +170,6 @@ gitdb2==4.0.2
# via gitpython
gitpython==3.0.6
# via trufflehog
graphene==2.1.9
# via graphene-django
graphene-django==2.13.0
# via wagtail-grapple
graphql-core==2.3.2
# via
# graphene
# graphene-django
# graphql-relay
# wagtail-grapple
graphql-relay==2.0.1
# via graphene
gunicorn==20.1.0
# via -r requirements.in
h11==0.13.0
@ -265,7 +253,7 @@ pillow==9.0.1
# via
# -r requirements.in
# wagtail
pip-tools==6.5.1
pip-tools==6.6.2
# via -r requirements-dev.in
platformdirs==2.5.1
# via
@ -278,11 +266,6 @@ portalocker==2.4.0
# via concurrent-log-handler
pre-commit==2.17.0
# via -r requirements-dev.in
promise==2.3
# via
# graphene-django
# graphql-core
# graphql-relay
prompt-toolkit==3.0.28
# via ipython
psycopg2-binary==2.9.3
@ -353,25 +336,15 @@ requests==2.27.1
# coreapi
# djangorestframework-stubs
# wagtail
rx==1.6.1
# via graphql-core
sentry-sdk==1.5.8
# via -r requirements.in
singledispatch==3.7.0
# via graphene-django
six==1.16.0
# via
# asttokens
# django-coverage-plugin
# graphene
# graphene-django
# graphql-core
# graphql-relay
# html5lib
# l18n
# promise
# python-dateutil
# singledispatch
# virtualenv
smmap==5.0.0
# via gitdb
@ -427,8 +400,6 @@ typing-extensions==4.1.1
# django-stubs-ext
# djangorestframework-stubs
# mypy
unidecode==1.3.4
# via graphene-django
uritemplate==4.1.1
# via
# coreapi
@ -443,18 +414,12 @@ uvloop==0.16.0
# via uvicorn
virtualenv==20.14.0
# via pre-commit
wagtail==2.16.2
wagtail==3.0.0
# via
# -r requirements.in
# wagtail-factories
# wagtail-grapple
# wagtail-headless-preview
wagtail-factories==2.0.1
# via -r requirements.in
wagtail-grapple==0.14.1
# via -r requirements.in
wagtail-headless-preview==0.2.1
# via wagtail-grapple
watchdog==2.1.7
# via werkzeug
watchgod==0.8.1

View File

@ -33,7 +33,5 @@ structlog
python-json-logger
concurrent-log-handler
wagtail<3
wagtail>=3,<4
wagtail-factories
wagtail-grapple==0.14.1

View File

@ -4,8 +4,6 @@
#
# pip-compile --output-file=requirements.txt requirements.in
#
aniso8601==7.0.0
# via graphene
anyascii==0.3.1
# via wagtail
anyio==3.5.0
@ -48,21 +46,21 @@ deprecated==1.2.13
# via redis
dj-database-url==0.5.0
# via -r requirements.in
django==3.2.12
django==3.2.13
# via
# -r requirements.in
# django-cors-headers
# django-filter
# django-htmx
# django-model-utils
# django-modelcluster
# django-permissionedforms
# django-redis
# django-taggit
# django-treebeard
# djangorestframework
# drf-spectacular
# graphene-django
# wagtail
# wagtail-grapple
django-click==2.3.0
# via -r requirements.in
django-cors-headers==3.11.0
@ -75,7 +73,9 @@ django-ipware==4.0.2
# via -r requirements.in
django-model-utils==4.2.0
# via -r requirements.in
django-modelcluster==5.3
django-modelcluster==6.0
# via wagtail
django-permissionedforms==0.1
# via wagtail
django-ratelimit==3.0.1
# via -r requirements.in
@ -102,18 +102,6 @@ factory-boy==3.2.1
# via wagtail-factories
faker==13.11.1
# via factory-boy
graphene==2.1.9
# via graphene-django
graphene-django==2.13.0
# via wagtail-grapple
graphql-core==2.3.2
# via
# graphene
# graphene-django
# graphql-relay
# wagtail-grapple
graphql-relay==2.0.1
# via graphene
gunicorn==20.1.0
# via -r requirements.in
h11==0.13.0
@ -148,11 +136,6 @@ pillow==9.0.1
# wagtail
portalocker==2.4.0
# via concurrent-log-handler
promise==2.3
# via
# graphene-django
# graphql-core
# graphql-relay
psycopg2-binary==2.9.3
# via -r requirements.in
pycparser==2.21
@ -188,23 +171,13 @@ redis==4.2.1
# django-redis
requests==2.27.1
# via wagtail
rx==1.6.1
# via graphql-core
sentry-sdk==1.5.8
# via -r requirements.in
singledispatch==3.7.0
# via graphene-django
six==1.16.0
# via
# graphene
# graphene-django
# graphql-core
# graphql-relay
# html5lib
# l18n
# promise
# python-dateutil
# singledispatch
sniffio==1.2.0
# via anyio
soupsieve==2.3.2.post1
@ -219,8 +192,6 @@ telepath==0.2
# via wagtail
text-unidecode==1.3
# via python-slugify
unidecode==1.3.4
# via graphene-django
uritemplate==4.1.1
# via drf-spectacular
urllib3==1.26.9
@ -231,18 +202,12 @@ uvicorn[standard]==0.17.6
# via -r requirements.in
uvloop==0.16.0
# via uvicorn
wagtail==2.16.2
wagtail==3.0.0
# via
# -r requirements.in
# wagtail-factories
# wagtail-grapple
# wagtail-headless-preview
wagtail-factories==2.0.1
# via -r requirements.in
wagtail-grapple==0.14.1
# via -r requirements.in
wagtail-headless-preview==0.2.1
# via wagtail-grapple
watchgod==0.8.1
# via uvicorn
webencodings==0.5.1

View File

@ -1,6 +1,6 @@
import djclick as click
from django.conf import settings
from wagtail.core.models import Locale
from wagtail.models import Locale
@click.command()

View File

@ -3,8 +3,8 @@
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
class Migration(migrations.Migration):
@ -65,7 +65,7 @@ class Migration(migrations.Migration):
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('minutes', models.PositiveIntegerField(default=15)),
('package', models.CharField(blank=True, default='', max_length=255)),
('contents', wagtail.core.fields.StreamField([('video', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('rise_training', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('podcast', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock()), ('url', wagtail.core.blocks.URLBlock())])), ('competence', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock())])), ('exercise', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock())])), ('self_evaluation', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock())])), ('document', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock())])), ('knowledge', wagtail.core.blocks.StructBlock([('description', wagtail.core.blocks.TextBlock())]))])),
('contents', wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('rise_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('podcast', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.URLBlock())])), ('competence', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('self_evaluation', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())])), ('knowledge', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())]))])),
],
options={
'verbose_name': 'Learning Unit',

View File

@ -1,11 +1,10 @@
# Create your models here.
from django.utils.text import slugify
from grapple.helpers import register_query_field
from wagtail.api import APIField
from wagtail.core.blocks import StreamBlock
from wagtail.core.fields import StreamField
from wagtail.core.models import Page, Orderable
from wagtail.blocks import StreamBlock
from wagtail.fields import StreamField
from wagtail.models import Page, Orderable
from vbv_lernwelt.learnpath.models_competences import *
from vbv_lernwelt.learnpath.models_learning_unit_content import RiseTrainingBlock, VideoBlock, PodcastBlock, \
@ -13,7 +12,6 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import RiseTrainingBloc
from vbv_lernwelt.learnpath.serializer_helpers import get_it_serializer_class
@register_query_field("learning_path")
class LearningPath(Page):
# PageChooserPanel('related_page', 'demo.PublisherPage'),

View File

@ -1,7 +1,7 @@
from django.db import models
from wagtail.core.models import Page, Orderable
from wagtail.models import Page, Orderable
from modelcluster.fields import ParentalKey
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel, InlinePanel
from wagtail.admin.panels import FieldPanel, StreamFieldPanel, InlinePanel
class CompetencePage(Page):

View File

@ -1,4 +1,4 @@
from wagtail.core import blocks
from wagtail import blocks
class VideoBlock(blocks.StructBlock):

View File

@ -1,6 +1,6 @@
import wagtail_factories
from django.conf import settings
from wagtail.core.models import Site, Page
from wagtail.models import Site, Page
from vbv_lernwelt.core.admin import User
from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningUnit

View File

@ -1,6 +1,6 @@
from django.conf import settings
from django.test import TestCase
from wagtail.core.models import Locale
from wagtail.models import Locale
from vbv_lernwelt.learnpath.models import LearningPath
from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path