Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 99 additions & 87 deletions eureka/main/management/commands/bootstrap_site_tree.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from django.core.management.base import (
BaseCommand, CommandError
)
from eureka.main.blocks import VideoEmbedBlock
from eureka.main.models import (
HomePage, ImprovisationTypeIndexPage, ImprovisationTypePage,
EarTrainingIndexPage, EarTrainingLevelPage,
EarTrainingElementContainerPage, EarTrainingElementPage,
ImprovisationCombinationIndexPage, ImprovisationCombinationPage
)
from wagtail.core.blocks import StreamBlock, StreamValue, RichTextBlock
from wagtail.core.models import Page, Site
from wagtail.core.rich_text import RichText
from wagtailmenus.conf import settings

IMPROV_TYPE_LIST = [
Expand All @@ -33,73 +30,70 @@ def create_ear_training_elements(et_root_page, element_list):
imp_type_page = EarTrainingElementPage(
title=improv_type
)
imp_type_page.body = [('topic', {
'title': 'Out of Tempo',
'musical_elements': [{
'element_title': 'Beginner',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}, {
'element_title': 'Intermediate',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}, {
'element_title': 'Advanced',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}]
}), ('topic', {
'title': 'In Tempo',
'musical_elements': [{
'element_title': 'Beginner',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}, {
'element_title': 'Intermediate',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}, {
'element_title': 'Advanced',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
]
)
}]
})]
imp_type_page.body = [
{
'type': 'topic',
'value': {
'title': 'Out of Tempo',
'musical_elements': [{
'element_title': 'Beginner',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}, {
'element_title': 'Intermediate',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}, {
'element_title': 'Advanced',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}]
}
},
{
'type': 'topic',
'value': {
'title': 'In Tempo',
'musical_elements': [{
'element_title': 'Beginner',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}, {
'element_title': 'Intermediate',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}, {
'element_title': 'Advanced',
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
}
]
}]
}
}
]
element_container.add_child(instance=imp_type_page)
imp_type_page.save_revision().publish()

Expand Down Expand Up @@ -137,7 +131,10 @@ def handle(self, *args, **options):
for improv_type in IMPROV_TYPE_LIST:
improv_type_page = ImprovisationTypePage(
title=improv_type,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
improv_type_index.add_child(instance=improv_type_page)
improv_type_page.save_revision().publish()
Expand All @@ -155,7 +152,10 @@ def handle(self, *args, **options):
title='Introduction to Ear Training One',
tab_title='Ear Training One',
show_in_menus=True,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
ear_training_index.add_child(instance=et_one)
et_one.save_revision().publish()
Expand All @@ -173,19 +173,19 @@ def handle(self, *args, **options):
'title': 'Out of tempo',
'musical_elements': [{
'element_title': 'Out of tempo with intervals',
'content': StreamValue(
stream_block=StreamBlock([
('rich_text', RichTextBlock()),
('video', VideoEmbedBlock()),
]),
stream_data=[
('rich_text', RichText('<p>TBD</p>')),
('video', {
'content': [
{
'type': 'rich_text',
'value': '<p>TBD</p>'
},
{
'type': 'video',
'value': {
'url': YT_TEST_VIDEO,
'description': 'A very fine video'
}),
]
)
}
}
]
}]
})]
et_page.save_revision().publish()
Expand All @@ -195,7 +195,10 @@ def handle(self, *args, **options):
title='Introduction to Ear Training Two',
tab_title='Ear Training Two',
show_in_menus=True,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
ear_training_index.add_child(instance=et_two)
et_two.save_revision().publish()
Expand All @@ -212,7 +215,10 @@ def handle(self, *args, **options):
title='Introduction to Ear Training Three',
tab_title='Ear Training Three',
show_in_menus=True,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
ear_training_index.add_child(instance=et_three)
et_three.save_revision().publish()
Expand All @@ -229,7 +235,10 @@ def handle(self, *args, **options):
title='Introduction to Ear Training Four',
tab_title='Ear Training Four',
show_in_menus=True,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
ear_training_index.add_child(instance=et_four)
et_four.save_revision().publish()
Expand All @@ -255,7 +264,10 @@ def handle(self, *args, **options):
combo_page = ImprovisationCombinationPage(
title=i,
show_in_menus=True,
body=[('rich_text', RichText('<p>TBD</p>'))]
body=[{
'type': 'rich_text',
'value': '<p>TBD</p>'
}]
)
improv_combo_index.add_child(instance=combo_page)
combo_page.save_revision().publish()
Expand Down
4 changes: 2 additions & 2 deletions eureka/main/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
EarTrainingElementContainerPage, EarTrainingLevelPage,
EarTrainingElementPage, pack_nav_pages
)
from wagtail.tests.utils import WagtailPageTests
from wagtail.tests.utils import WagtailPageTestCase


class PageTest(WagtailPageTests):
class PageTest(WagtailPageTestCase):
def test_ear_training_element_container_page(self):
"""Test that requests to an ear training container page
redirect to its first child"""
Expand Down
4 changes: 2 additions & 2 deletions eureka/main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
EarTrainingElementPage, ImprovisationCombinationIndexPage,
ImprovisationCombinationPage
)
from wagtail.tests.utils import WagtailPageTests
from wagtail.tests.utils import WagtailPageTestCase


class ViewTest(WagtailPageTests):
class ViewTest(WagtailPageTestCase):
"""These test check that the page can be routed and can
render templates cleanly"""
def test_smoketest(self):
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ django-contact-us==1.1.0
entrypoints==0.4

# wagtail requirements
wagtail==4.0.4
wagtail==4.1.9
django-modelcluster>=6.0,<7.0
django-permissionedforms>=0.1,<1.0
django-taggit>=5.0.1,<7.0
Expand All @@ -116,6 +116,7 @@ xlsxwriter>=1.2.8,<4.0
tablib[xls,xlsx]>=0.14.0
anyascii>=0.1.5
telepath>=0.1.1,<1
openpyxl==3.1.5

# wagtail 4.0 dependency
standard-imghdr==3.13.0; python_version>"3.12"
Expand Down
Loading