Skip to content

Commit

Permalink
Wagtail 5.2 (#1539)
Browse files Browse the repository at this point in the history
* upgrade to wagtail 5, change imports and update tests

* clean up unused oxauth functionality

* update deprecated template include

* drop columns, not tables for oxauth

* revert removing oxauth models

* bump wagtail, bug fix
  • Loading branch information
mwvolo authored Feb 8, 2024
1 parent 978e75e commit aa4f2c9
Show file tree
Hide file tree
Showing 36 changed files with 600 additions and 808 deletions.
1 change: 0 additions & 1 deletion allies/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
MultiFieldPanel)
from wagtail.fields import RichTextField
from wagtail.models import Page
from wagtail.images.edit_handlers import ImageChooserPanel

from openstax.functions import build_image_url
from snippets.models import Subject
Expand Down
8 changes: 4 additions & 4 deletions api/tests.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import json
from django.test import TestCase, Client
from django.test import TestCase

from wagtail.test.utils import WagtailTestUtils
from wagtail.images.tests.utils import Image, get_test_image_file
from wagtail.documents.models import Document

from api.models import FeatureFlag, WebviewSettings

from shared.test_utilities import assertPathDoesNotRedirectToTrailingSlash, mock_user_login
from shared.test_utilities import mock_user_login

class PagesAPI(TestCase, WagtailTestUtils):
def setUp(self):
Expand All @@ -18,7 +18,7 @@ def test_api_v2_pages_urls(self):
response = self.client.get('/apps/cms/api/v2/pages/')
self.assertEqual(response.status_code, 200)

response = self.client.get('/apps/cms/api/v2/pages')
response = self.client.get('/apps/cms/api/v2/pages', follow=True)
self.assertEqual(response.status_code, 200)


Expand Down Expand Up @@ -160,7 +160,7 @@ def test_sticky_api(self):
self.assertEqual(response.status_code, 200)

def test_errata_resource_api(self):
response = self.client.get('/apps/cms/api/errata-fields?field=resources')
response = self.client.get('/apps/cms/api/errata-fields/?field=resources')
self.assertNotIn('content', 'OpenStax Concept Coach')
self.assertNotIn('content', 'Rover by OpenStax')
self.assertEqual(response.status_code, 200)
Expand Down
209 changes: 140 additions & 69 deletions books/models.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion errata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def save(self, *args, **kwargs):

@hooks.register('register_admin_menu_item')
def register_errata_menu_item():
return MenuItem('Errata', '/django-admin/errata/errata', classnames='icon icon-form', order=10000)
return MenuItem('Errata', '/django-admin/errata/errata', classname='icon icon-form', order=10000)

def __str__(self):
return self.book.book_title
Expand Down
2 changes: 0 additions & 2 deletions extraadminfilters/filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from django.contrib.admin.filters import FieldListFilter
from django.db.models.fields import IntegerField, AutoField
from django.db.models.fields.related import OneToOneField, ForeignKey, ManyToOneRel


class MultipleSelectFieldListFilter(FieldListFilter):
Expand Down
4 changes: 2 additions & 2 deletions global_settings/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def register_strikethrough_feature(features):

@hooks.register('register_settings_menu_item')
def register_500_menu_item():
return MenuItem('Generate 500', reverse('throw_error'), classnames='icon icon-warning', order=10000)
return MenuItem('Generate 500', reverse('throw_error'), classname='icon icon-warning', order=10000)


@hooks.register('register_settings_menu_item')
def register_clear_cache_menu_item():
return MenuItem('Clear Cloudfront Cache', reverse('clear_entire_cache'), classnames='icon icon-bin', order=11000)
return MenuItem('Clear Cloudfront Cache', reverse('clear_entire_cache'), classname='icon icon-bin', order=11000)
242 changes: 0 additions & 242 deletions locked-requirements.txt

This file was deleted.

17 changes: 6 additions & 11 deletions news/models.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import json

from bs4 import BeautifulSoup

from django.db import models
from django import forms

from wagtail.models import Page, Orderable
from wagtail.fields import RichTextField, StreamField
from wagtail.admin.panels import FieldPanel, StreamFieldPanel, InlinePanel
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.documents.edit_handlers import DocumentChooserPanel
from wagtail.admin.panels import FieldPanel, InlinePanel
from wagtail.admin.widgets.slug import SlugInput
from wagtail.embeds.blocks import EmbedBlock
from wagtail.search import index
from wagtail import blocks
from wagtail.blocks import TextBlock, StructBlock, StreamBlock, FieldBlock, CharBlock, RichTextBlock, RawHTMLBlock, BooleanBlock
from wagtail.images.blocks import ImageChooserBlock
from wagtail.documents.blocks import DocumentChooserBlock
from wagtail.snippets.blocks import SnippetChooserBlock
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from wagtail.snippets.models import register_snippet
from wagtail.api import APIField
from wagtail.images.api.fields import ImageRenditionField
from wagtail.models import Site
Expand Down Expand Up @@ -171,7 +166,7 @@ class NewsIndex(Page):
]

promote_panels = [
FieldPanel('slug'),
FieldPanel('slug', widget=SlugInput),
FieldPanel('seo_title'),
FieldPanel('search_description'),
FieldPanel('promote_image')
Expand Down Expand Up @@ -385,7 +380,7 @@ def blog_collections(self):
]

promote_panels = [
FieldPanel('slug'),
FieldPanel('slug', widget=SlugInput),
FieldPanel('seo_title'),
FieldPanel('search_description'),
FieldPanel('promote_image')
Expand Down Expand Up @@ -592,7 +587,7 @@ def releases(self):
]

promote_panels = [
FieldPanel('slug'),
FieldPanel('slug', widget=SlugInput),
FieldPanel('seo_title'),
FieldPanel('search_description'),
FieldPanel('promote_image')
Expand Down Expand Up @@ -681,7 +676,7 @@ def get_sitemap_urls(self, request=None):
]

promote_panels = [
FieldPanel('slug'),
FieldPanel('slug', widget=SlugInput),
FieldPanel('seo_title'),
FieldPanel('search_description'),
FieldPanel('promote_image')
Expand Down
Loading

0 comments on commit aa4f2c9

Please sign in to comment.